there have been some sporadic reports of "dirent points to inode that
does not point back" errors.

the reports I've seen look harmless after repair; no deeper corruption
involved, the inode backpointer field is off and nothing else. we
haven't caught it in the act yet - i.e. found the transaction in the
journal that did it - but this is something self healing can cope with
fine until we get it root caused.

this series takes the fsck code and adds it to the lookup path - the
general strategy of self healing is "any time we've already lookup up
multiple keys, check the relationships between them whenever it doesn't
cost to do so".

note that self healing hasn't actually been flipped on yet; i.e. we
won't be repairing outside of fsck, just running the same checks fsck
does (and going ERO if they fire).

once this has been out there for a bit, we'll flip on self healing.

Kent Overstreet (4):
  bcachefs: fs-common.c -> namei.c
  bcachefs: Move bch2_check_dirent_target() to namei.c
  bcachefs: Refactor bch2_check_dirent_target()
  bcachefs: Run bch2_check_dirent_target() at lookup time

 fs/bcachefs/Makefile                 |   2 +-
 fs/bcachefs/dirent.c                 |  51 ++++++
 fs/bcachefs/dirent.h                 |   2 +
 fs/bcachefs/error.c                  |   2 +-
 fs/bcachefs/fs-ioctl.c               |   2 +-
 fs/bcachefs/fs.c                     |  34 ++--
 fs/bcachefs/fsck.c                   | 231 +--------------------------
 fs/bcachefs/inode.h                  |   1 +
 fs/bcachefs/{fs-common.c => namei.c} | 180 ++++++++++++++++++++-
 fs/bcachefs/{fs-common.h => namei.h} |  31 +++-
 fs/bcachefs/recovery.c               |   2 +-
 11 files changed, 289 insertions(+), 249 deletions(-)
 rename fs/bcachefs/{fs-common.c => namei.c} (75%)
 rename fs/bcachefs/{fs-common.h => namei.h} (61%)

-- 
2.49.0


Reply via email to