Whamcloud - gitweb
LU-5949 e2fsck: simplify inode badness handling 28/41328/5
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 30 Jul 2020 20:36:49 +0000 (14:36 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 8 Feb 2021 11:25:32 +0000 (11:25 +0000)
commit8725134d27574605c3da74b46df909e419d02b63
tree16a6e04c6729c488325752bb328b16f52023bb05
parent71b74579b7e6c5cfe6af05b00e45c8a75fce0d61
LU-5949 e2fsck: simplify inode badness handling

Move the badness increment into fix_problem() so that code does
not need to be spread across the code and explicitly set.  Instead,
take advantage of the fact that pctx->ino is almost always pointing
at the bad inode and increment badness whenever fix_problem() is
called on the inode.  This also handles new problems in the future.

That leaves only a handful of places in the code that need special
handling to either set a higher badness (e.g. inode blocks that are
directly referencing filesystem metadata or have wildly incorrect
timestamps), or should not contribute to inode badness at all.

The main exceptions are when reprocessing duplicate blocks in the
inode (badness already set), and cleaning bad entries in a directory
leaf block in check_dir_block(), which uses pctx->ino to reference
the parent directory inode number.  In such cases, fix_problem_bad()
is called with 0 badness, since the leaf block was been repaired,
and clearing the directory inode in this case is unnecessary.

This patch should be merged into original badness patch on rebase.

Fixes: 92a85a3ced2c ("e2fsck: track errors/badness found for each inode")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I96cd21b5976991f0bb1c63fc99857c80e23ebbe5
Reviewed-on: https://review.whamcloud.com/41328
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
18 files changed:
e2fsck/e2fsck.8.in
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/pass1b.c
e2fsck/pass2.c
e2fsck/pass3.c
e2fsck/pass4.c
e2fsck/problem.c
e2fsck/problem.h
e2fsck/unix.c
tests/f_ibadness/expect.1
tests/f_ibadness/script [new file with mode: 0644]
tests/f_ibadness_bad_extents/expect.1
tests/f_ibadness_bad_extents/image.gz
tests/f_ibadness_bad_extents/script [new file with mode: 0644]
tests/f_messy_inode/expect.1
tests/f_messy_inode/script
tests/filter.sed