xfs: scrub: Remove incorrect check executed on block format directories
PATCH 1/1 xfs: scrub: Remove incorrect check executed on block format directories
A directory with one directory block which in turns consists of two or more fs blocks is incorrectly flagged as corrupt by scrub since it assumes that "Block" format directories have a data fork single extent spanning the file offset range of [0, Dir block size - 1].
This commit fixes the bug by removing the incorrect check.
--- fs/xfs/scrub/dir.c | 9 --------- 1 file changed, 9 deletions(-)
fs/xfs/scrub/dir.c +0 -9
@@ -694,15 +694,6 @@ xchk_directory_blocks(/* Iterate all the data extents in the directory... */ found =xfs_iext_lookup_extent (sc->ip, ifp, lblk, &icur, &got);while (found && !(sc->sm->sm_flags &XFS_SCRUB_OFLAG_CORRUPT )) { -/* Block directories only have a single block at offset 0. */ -if (is_block && - (got.br_startoff >0 || - got.br_blockcount != args.geo->fsbcount)) { -xchk_fblock_set_corrupt (sc,XFS_DATA_FORK , - got.br_startoff); -break ; - } -/* No more data blocks... */ if (got.br_startoff >= leaf_lblk)break ;
Signature · 1 line
2.29.2
Quoted 6 lines · Chandan Babu R
A directory with one directory block which in turns consists of two or more fs blocks is incorrectly flagged as corrupt by scrub since it assumes that "Block" format directories have a data fork single extent spanning the file offset range of [0, Dir block size - 1].
This commit fixes the bug by removing the incorrect check.
It took me a minute to figure out that this isn't merely removing a check that triggered somewhere; the check is incorrect /and/ redundant because xfs_dir2_isblock sets is_block based on what it finds in the iext tree, so it makes no sense to check that result against the iext tree at all.
--D
Quoted 28 lines
Signed-off-by Chandan Babu R <[email protected]>--- fs/xfs/scrub/dir.c | 9 --------- 1 file changed, 9 deletions(-)fs/xfs/scrub/dir.c +0
-9@@ -694,15 +694,6 @@ xchk_directory_blocks(/* Iterate all the data extents in the directory... */ found =xfs_iext_lookup_extent (sc->ip, ifp, lblk, &icur, &got);while (found && !(sc->sm->sm_flags &XFS_SCRUB_OFLAG_CORRUPT )) { -/* Block directories only have a single block at offset 0. */ -if (is_block && - (got.br_startoff >0 || - got.br_blockcount != args.geo->fsbcount)) { -xchk_fblock_set_corrupt (sc,XFS_DATA_FORK , - got.br_startoff); -break ; - } -/* No more data blocks... */ if (got.br_startoff >= leaf_lblk)break ;Signature · 1 line
2.29.2