bcachefs: Improve transaction restart handling in fsck code
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 28 Oct 2021 20:16:55 +0000 (16:16 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:15 +0000 (17:09 -0400)
commit285b181ad460bb240041a9ca7935f9e884040405
treeb1c04e61d1e45e10540520dad0ae87511675adb1
parent6caf05785060b2522f577b000849bbc172efb135
bcachefs: Improve transaction restart handling in fsck code

The fsck code has been handling transaction restarts locally, to avoid
calling fsck_err() multiple times (and asking the user/logging the error
multiple times) on transaction restart.

However, with our improving assertions about iterator validity, this
isn't working anymore - the code wasn't entirely correct, in ways that
are fine for now but are going to matter once we start wanting online
fsck.

This code converts much of the fsck code to handle transaction restarts
in a more rigorously correct way - moving restart handling up to the top
level of check_dirent, check_xattr and others - at the cost of logging
errors multiple times on transaction restart.

Fixing the issues with logging errors multiple times is probably going
to require memoizing calls to fsck_err() - we'll leave that for future
improvements.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/dirent.c
fs/bcachefs/fsck.c
fs/bcachefs/inode.h
fs/bcachefs/opts.h