[PATCH] btrfs-progs: check/lowmem: Fix a false alert caused by hole beyond isize check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 91a12c0ddb00 ("btrfs-progs: fix lowmem check's handling of
holes") makes lowmem mode check to skip hole detection after isize.

However it also skipped the extent end update if the extent ends just at
isize.

This caused fsck-test/001 to fail with false hole error report.

Fix it by updating the @end parameter if we have an extent ends at inode
size.

Fixes: 91a12c0ddb00 ("btrfs-progs: fix lowmem check's handling of holes")
Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
David, please fold the fix into the original patch.
---
 check/mode-lowmem.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 7f734f974d02..1d2df349a9bf 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -2165,8 +2165,12 @@ static int check_file_extent(struct btrfs_root *root, struct btrfs_path *path,
 		}
 	}
 
-	if (fkey.offset + extent_num_bytes < isize)
-		*end = fkey.offset + extent_num_bytes;
+	/*
+	 * Don't update extent end beyond rounded up isize. As holes
+	 * after isize is not considered as missing holes.
+	 */
+	*end = min(round_up(isize, root->fs_info->sectorsize),
+		   fkey.offset + extent_num_bytes);
 	if (!is_hole)
 		*size += extent_num_bytes;
 
-- 
2.25.1




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux