btrfs-progs: check/lowmem: Fix a false alert caused by hole beyond isize check
PATCH 1/1 btrfs-progs: check/lowmem: Fix a false alert caused by hole beyond isize check
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.
---
David, please fold the fix into the original patch.
--- check/mode-lowmem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
check/mode-lowmem.c +6 -2
@@ -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;
Signature · 1 line
2.25.1
Quoted 8 lines · Qu Wenruo
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.
Quoted 7 lines
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 <[email protected]>---
David, please fold the fix into the original patch.
Folded, thanks for the fix. The lowmem mode tests still don't pass for me, have been failing since 5.1. I've now added a make target for it so it's easier to run them without setting up the env variables.
Quoted 12 lines · David Sterba
Quoted 11 lines · Qu Wenruo
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.
Quoted 9 lines
Quoted 4 lines
Fixes 91a12c0ddb00 ("btrfs-progs: fix lowmem check's handling of holes")Signed-off-by Qu Wenruo <[email protected]>---
David, please fold the fix into the original patch.Folded, thanks for the fix. The lowmem mode tests still don't pass for me, have been failing since 5.1. I've now added a make target for it so it's easier to run them without setting up the env variables.
Mind to provide the fsck-test-result.txt for me to further investigate the problem?
Thanks,
Qu
Quoted 20 lines · Qu Wenruo
Quoted 17 lines · David Sterba
Quoted 15 lines · Qu Wenruo
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 <[email protected]>---
David, please fold the fix into the original patch.
Quoted 7 lines
Quoted 4 lines
Folded, thanks for the fix. The lowmem mode tests still don't pass for me, have been failing since 5.1. I've now added a make target for it so it's easier to run them without setting up the env variables.
Mind to provide the fsck-test-result.txt for me to further investigate the problem?
My bad, I didn't catch the problem in the pull request, and my test environments all failed to catch the problem.
The lack of diversity makes it pretty hard to detect it, as it looks like all machines tends to zero the unintialized stack structure.
Anyway, the proper fix for that long existing v5.1 bug is here:
https://patchwork.kernel.org/patch/11454395/
And I'll look into the possibility to auto use valgrind in selftests to avoid similar bug to sneak in.
Thanks,
Qu
Quoted 4 lines
Thanks,
Qu
Quoted 27 lines · Qu Wenruo
Quoted 18 lines · Qu Wenruo
Quoted 17 lines · David Sterba
Quoted 15 lines · Qu Wenruo
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 <[email protected]>---
David, please fold the fix into the original patch.Quoted 7 lines
Quoted 4 lines
Folded, thanks for the fix. The lowmem mode tests still don't pass for me, have been failing since 5.1. I've now added a make target for it so it's easier to run them without setting up the env variables.
Mind to provide the fsck-test-result.txt for me to further investigate the problem?
Quoted 8 lines
My bad, I didn't catch the problem in the pull request, and my test environments all failed to catch the problem.
The lack of diversity makes it pretty hard to detect it, as it looks like all machines tends to zero the unintialized stack structure.
Anyway, the proper fix for that long existing v5.1 bug is here:
https://patchwork.kernel.org/patch/11454395/
Thank you, that crash was probably the last big thing to do before a release.
Quoted 2 lines
And I'll look into the possibility to auto use valgrind in selftests to avoid similar bug to sneak in.
As you've found out, the valgrind or other instrumentation is there but there are some problems. For that the GCCs sanitizers are more lightweight option, but they make the test pass.