]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix a bug in the online fsck directory leaf1 bestcount check
authorDarrick J. Wong <djwong@kernel.org>
Wed, 15 Dec 2021 19:53:15 +0000 (11:53 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 21 Dec 2021 17:49:41 +0000 (09:49 -0800)
commit54d23ff5594252ca71d89bc73585673cd3638a51
treeecf725047485ff52bc027148eff8e686e9b524a5
parent765b156ce9dc26d43cf8930e0531af1c0e960533
xfs: fix a bug in the online fsck directory leaf1 bestcount check

When xfs_scrub encounters a directory with a leaf1 block, it tries to
validate that the leaf1 block's bestcount (aka the best free count of
each directory data block) is the correct size.  Previously, this author
believed that comparing bestcount to the directory isize (since
directory data blocks are under isize, and leaf/bestfree blocks are
above it) was sufficient.

Unfortunately during testing of online repair, it was discovered that it
is possible to create a directory with a hole between the last directory
block and isize.  The directory code seems to handle this situation just
fine and xfs_repair doesn't complain, which effectively makes this quirk
part of the disk format.

Fix the check to work properly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/dir.c