fstests: new helper to skip xfs_check
PATCH 1/1 fstests: new helper to skip xfs_check
The _xfs_check sometimes need to take too much memory, some quota related cases (e.g: xfs/442, generic/232 etc) always trigger OOM killer.
[93334.020194] xfs_db invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=-1000 [93334.020206] xfs_db cpuset=/ mems_allowed=0 [93334.020213] CPU: 2 PID: 977 Comm: xfs_db Kdump: loaded Not tainted 4.18.0-139.el8.ppc64le+debug #1 [93334.020217] Call Trace: [93334.020223] [c0000001cb163640] [c000000001035754] dump_stack+0xe8/0x164 (unreliable) [93334.020229] [c0000001cb163690] [c0000000004a77dc] dump_header+0x7c/0x670 [93334.020234] [c0000001cb1637b0] [c0000000004a872c] oom_kill_process+0x26c/0x3d0 [93334.020239] [c0000001cb163800] [c0000000004aa438] out_of_memory+0x278/0x930 [93334.020244] [c0000001cb1638a0] [c0000000004bd6c8] __alloc_pages_nodemask+0x1ab8/0x1b70 [93334.020248] [c0000001cb163ae0] [c00000000058b8dc] alloc_pages_vma+0xec/0x660 [93334.020253] [c0000001cb163b50] [c00000000052b544] do_anonymous_page+0x124/0xac0 [93334.020258] [c0000001cb163bc0] [c000000000534918] __handle_mm_fault+0xda8/0x1b60 [93334.020263] [c0000001cb163cb0] [c000000000535948] handle_mm_fault+0x278/0x5a0 [93334.020268] [c0000001cb163d00] [c00000000008b30c] __do_page_fault+0x27c/0xe00 [93334.020273] [c0000001cb163df0] [c00000000008bec8] do_page_fault+0x38/0xf0 [93334.020278] [c0000001cb163e30] [c00000000000a904] handle_page_fault+0x18/0x38 [93334.020281] Mem-Info: [93334.020286] active_anon:93769 inactive_anon:13540 isolated_anon:0 [93334.020286] active_file:23 inactive_file:8 isolated_file:0 [93334.020286] unevictable:0 dirty:0 writeback:0 unstable:0 [93334.020286] slab_reclaimable:1543 slab_unreclaimable:8926 [93334.020286] mapped:69 shmem:15 pagetables:76 bounce:0 [93334.020286] free:2756 free_pcp:0 free_cma:0
The xfs_check related code is old, and nearly won't be maintained too much, test xfs_repair and xfs_scrub is much more important than xfs_check. But the xfstests always do a POST-xfs_check at the end of each cases. So I'd like to add a new helper named _require_scratch_no_xfs_check to skip xfs_check from some sub-cases.
---
Hi,
Maybe this patch not the best way to deal with this issue. Please feel free to tell me if you have better idea.
Thanks,
Zorro
common/rc | 1 + common/xfs | 26 ++++++++++++++++++++++++++ tests/generic/232 | 2 ++ tests/generic/233 | 2 ++ tests/generic/234 | 2 ++ tests/xfs/442 | 2 ++ 6 files changed, 35 insertions(+)
common/rc +1 -0
@@ -1570,6 +1570,7 @@ _require_scratch() { _require_scratch_nocheck touch ${RESULT_DIR}/require_scratch + touch ${RESULT_DIR}/require_scratch.xfs_check } # require a scratch dev of a minimum size (in kb)
common/xfs +26 -0
@@ -168,11 +168,37 @@ _scratch_mkfs_xfs() return $mkfs_status } +# Usage: _require_scratch_no_xfs_check [limit_memsize] +# +# Due to xfs_check costs too much memory, sometimes it cause OOM when test on +# low memory machine. This function is used to skip xfs_check conditionally +# or unconditionally. +# +# Note: must be called after _require_scratch. +_require_scratch_no_xfs_check() +{ + local bound=$1 + local freemem + + freemem=`_free_memory_bytes` + if [ -n "$bound" ];then + if [ $freemem -lt $bound ];then + rm -f ${RESULT_DIR}/require_scratch.xfs_check + fi + else + rm -f ${RESULT_DIR}/require_scratch.xfs_check + fi +} + # xfs_check script is planned to be deprecated. But, we want to # be able to invoke "xfs_check" behavior in xfstests in order to # maintain the current verification levels. _xfs_check() { + if [ ! -f "${RESULT_DIR}/require_scratch.xfs_check" ];then + return 0 + fi + OPTS=" " DBOPTS=" " USAGE="Usage: xfs_check [-fsvV] [-l logdev] [-i ino]... [-b bno]... special"
tests/generic/232 +2 -0
@@ -52,6 +52,8 @@ _fsstress() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _scratch_mkfs > $seqres.full 2>&1
tests/generic/233 +2 -0
@@ -56,6 +56,8 @@ _fsstress() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _require_user
tests/generic/234 +2 -0
@@ -72,6 +72,8 @@ test_setting() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota # real QA test starts here
tests/xfs/442 +2 -0
@@ -36,6 +36,8 @@ _supported_fs xfs _supported_os Linux _require_scratch_reflink +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _require_command "$KILLALL_PROG" "killall"
Signature · 1 line
2.17.2
Quoted 34 lines · Zorro Lang
The
_xfs_checksometimes need to take too much memory, some quota related cases (e.g: xfs/442, generic/232 etc) always trigger OOM killer.[93334.020194] xfs_db invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=-1000 [93334.020206] xfs_db cpuset=/ mems_allowed=0 [93334.020213] CPU: 2 PID: 977 Comm: xfs_db Kdump: loaded Not tainted 4.18.0-139.el8.ppc64le+debug #1 [93334.020217] Call Trace: [93334.020223] [c0000001cb163640] [c000000001035754] dump_stack+0xe8/0x164 (unreliable) [93334.020229] [c0000001cb163690] [c0000000004a77dc] dump_header+0x7c/0x670 [93334.020234] [c0000001cb1637b0] [c0000000004a872c] oom_kill_process+0x26c/0x3d0 [93334.020239] [c0000001cb163800] [c0000000004aa438] out_of_memory+0x278/0x930 [93334.020244] [c0000001cb1638a0] [c0000000004bd6c8] __alloc_pages_nodemask+0x1ab8/0x1b70 [93334.020248] [c0000001cb163ae0] [c00000000058b8dc] alloc_pages_vma+0xec/0x660 [93334.020253] [c0000001cb163b50] [c00000000052b544] do_anonymous_page+0x124/0xac0 [93334.020258] [c0000001cb163bc0] [c000000000534918] __handle_mm_fault+0xda8/0x1b60 [93334.020263] [c0000001cb163cb0] [c000000000535948] handle_mm_fault+0x278/0x5a0 [93334.020268] [c0000001cb163d00] [c00000000008b30c] __do_page_fault+0x27c/0xe00 [93334.020273] [c0000001cb163df0] [c00000000008bec8] do_page_fault+0x38/0xf0 [93334.020278] [c0000001cb163e30] [c00000000000a904] handle_page_fault+0x18/0x38 [93334.020281] Mem-Info: [93334.020286] active_anon:93769 inactive_anon:13540 isolated_anon:0 [93334.020286] active_file:23 inactive_file:8 isolated_file:0 [93334.020286] unevictable:0 dirty:0 writeback:0 unstable:0 [93334.020286] slab_reclaimable:1543 slab_unreclaimable:8926 [93334.020286] mapped:69 shmem:15 pagetables:76 bounce:0 [93334.020286] free:2756 free_pcp:0 free_cma:0The
xfs_checkrelated code is old, and nearly won't be maintained too much, testxfs_repairandxfs_scrubis much more important thanxfs_check. But the xfstests always do a POST-xfs_check at the end of each cases. So I'd like to add a new helper named_require_scratch_no_xfs_checkto skipxfs_checkfrom some sub-cases.
Quoted 7 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
Maybe this patch not the best way to deal with this issue. Please feel free to tell me if you have better idea.
I would just get rid of it (and have tried several times) but have not had the time to check that xfs_repair can detect every corruption that xfs_check can.
(To get started, I think it involves forking the dangerous_repair group tests to run _xfs_check and xfs_repair -n one after the other to compare outputs.)
--D
Quoted 120 lines
Thanks,
Zorrocommon/rc | 1 + common/xfs | 26 ++++++++++++++++++++++++++ tests/generic/232 | 2 ++ tests/generic/233 | 2 ++ tests/generic/234 | 2 ++ tests/xfs/442 | 2 ++ 6 files changed, 35 insertions(+)common/rc +1
-0@@ -1570,6 +1570,7 @@ _require_scratch() { _require_scratch_nocheck touch ${RESULT_DIR}/require_scratch + touch ${RESULT_DIR}/require_scratch.xfs_check } # require a scratch dev of a minimum size (in kb)common/xfs +26
-0@@ -168,11 +168,37 @@ _scratch_mkfs_xfs() return $mkfs_status } +# Usage: _require_scratch_no_xfs_check [limit_memsize] +# +# Due to xfs_check costs too much memory, sometimes it cause OOM when test on +# low memory machine. This function is used to skip xfs_check conditionally +# or unconditionally. +# +# Note: must be called after _require_scratch. +_require_scratch_no_xfs_check() +{ + local bound=$1 + local freemem + + freemem=`_free_memory_bytes` + if [ -n "$bound" ];then + if [ $freemem -lt $bound ];then + rm -f ${RESULT_DIR}/require_scratch.xfs_check + fi + else + rm -f ${RESULT_DIR}/require_scratch.xfs_check + fi +} + # xfs_check script is planned to be deprecated. But, we want to # be able to invoke "xfs_check" behavior in xfstests in order to # maintain the current verification levels. _xfs_check() { + if [ ! -f "${RESULT_DIR}/require_scratch.xfs_check" ];then + return 0 + fi + OPTS=" " DBOPTS=" " USAGE="Usage: xfs_check [-fsvV] [-l logdev] [-i ino]... [-b bno]... special"tests/generic/232 +2
-0@@ -52,6 +52,8 @@ _fsstress() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _scratch_mkfs > $seqres.full 2>&1tests/generic/233 +2
-0@@ -56,6 +56,8 @@ _fsstress() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _require_usertests/generic/234 +2
-0@@ -72,6 +72,8 @@ test_setting() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota # real QA test starts heretests/xfs/442 +2
-0@@ -36,6 +36,8 @@ _supported_fs xfs _supported_os Linux _require_scratch_reflink +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _require_command "$KILLALL_PROG" "killall"Signature · 1 line
2.17.2
Quoted 43 lines · Darrick J. Wong
Quoted 34 lines · Zorro Lang
The
_xfs_checksometimes need to take too much memory, some quota related cases (e.g: xfs/442, generic/232 etc) always trigger OOM killer.[93334.020194] xfs_db invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=-1000 [93334.020206] xfs_db cpuset=/ mems_allowed=0 [93334.020213] CPU: 2 PID: 977 Comm: xfs_db Kdump: loaded Not tainted 4.18.0-139.el8.ppc64le+debug #1 [93334.020217] Call Trace: [93334.020223] [c0000001cb163640] [c000000001035754] dump_stack+0xe8/0x164 (unreliable) [93334.020229] [c0000001cb163690] [c0000000004a77dc] dump_header+0x7c/0x670 [93334.020234] [c0000001cb1637b0] [c0000000004a872c] oom_kill_process+0x26c/0x3d0 [93334.020239] [c0000001cb163800] [c0000000004aa438] out_of_memory+0x278/0x930 [93334.020244] [c0000001cb1638a0] [c0000000004bd6c8] __alloc_pages_nodemask+0x1ab8/0x1b70 [93334.020248] [c0000001cb163ae0] [c00000000058b8dc] alloc_pages_vma+0xec/0x660 [93334.020253] [c0000001cb163b50] [c00000000052b544] do_anonymous_page+0x124/0xac0 [93334.020258] [c0000001cb163bc0] [c000000000534918] __handle_mm_fault+0xda8/0x1b60 [93334.020263] [c0000001cb163cb0] [c000000000535948] handle_mm_fault+0x278/0x5a0 [93334.020268] [c0000001cb163d00] [c00000000008b30c] __do_page_fault+0x27c/0xe00 [93334.020273] [c0000001cb163df0] [c00000000008bec8] do_page_fault+0x38/0xf0 [93334.020278] [c0000001cb163e30] [c00000000000a904] handle_page_fault+0x18/0x38 [93334.020281] Mem-Info: [93334.020286] active_anon:93769 inactive_anon:13540 isolated_anon:0 [93334.020286] active_file:23 inactive_file:8 isolated_file:0 [93334.020286] unevictable:0 dirty:0 writeback:0 unstable:0 [93334.020286] slab_reclaimable:1543 slab_unreclaimable:8926 [93334.020286] mapped:69 shmem:15 pagetables:76 bounce:0 [93334.020286] free:2756 free_pcp:0 free_cma:0The
xfs_checkrelated code is old, and nearly won't be maintained too much, testxfs_repairandxfs_scrubis much more important thanxfs_check. But the xfstests always do a POST-xfs_check at the end of each cases. So I'd like to add a new helper named_require_scratch_no_xfs_checkto skipxfs_checkfrom some sub-cases.Quoted 7 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
Maybe this patch not the best way to deal with this issue. Please feel free to tell me if you have better idea.
Quoted 7 lines
I would just get rid of it (and have tried several times) but have not had the time to check that
xfs_repaircan detect every corruption thatxfs_checkcan.(To get started, I think it involves forking the
dangerous_repairgroup tests to run_xfs_checkandxfs_repair-n one after the other to compare outputs.)
JFYI, I remembered I hit once xfs_check failure[1] which xfs_repair -n didn't find. And then, this bug fixed by another bug(CLOSE DUPLICATE):
https://bugzilla.kernel.org/show_bug.cgi?id=200137
Thanks,
Zorro
_check_xfs_filesystem: filesystem on /dev/mapper/xxxx-xfstest is inconsistent (c) *** xfs_check output ***
bad nblocks 2 for free inode 1028
block 0/549 type unknown not expected
block 0/550 type unknown not expected
# xfs_repair -n /dev/mapper/xxxx-xfstest
Phase 1 - find and verify superblock...
- reporting progress in intervals of 15 minutes
Phase 2 - using internal log
- zero log...
- scan filesystem freespace and inode maps...
- 05:54:54: scanning filesystem freespace - 16 of 16 allocation groups done
- found root inode chunk
Phase 3 - for each AG...
- scan (but don't clear) agi unlinked lists...
- 05:54:54: scanning agi unlinked lists - 16 of 16 allocation groups done
- process known inodes and perform inode discovery...
- agno = 15
- agno = 0
- agno = 1
- agno = 2
- agno = 3
- agno = 4
- agno = 5
- agno = 6
- agno = 7
- agno = 8
- agno = 9
- agno = 10
- agno = 11
- agno = 12
- agno = 13
- agno = 14
- 05:54:54: process known inodes and inode discovery - 64 of 64 inodes done
- process newly discovered inodes...
- 05:54:54: process newly discovered inodes - 16 of 16 allocation groups done
Phase 4 - check for duplicate blocks...
- setting up duplicate extent list...
- 05:54:54: setting up duplicate extent list - 16 of 16 allocation groups done
- check for inodes claiming duplicate blocks...
- agno = 0
- agno = 6
- agno = 10
- agno = 3
- agno = 4
- agno = 5
- agno = 8
- agno = 7
- agno = 1
- agno = 9
- agno = 15
- agno = 11
- agno = 12
- agno = 14
- agno = 13
- agno = 2
- 05:54:54: check for inodes claiming duplicate blocks - 64 of 64 inodes done
No modify flag set, skipping phase 5
Phase 6 - check inode connectivity...
- traversing filesystem ...
- traversal finished ...
- moving disconnected inodes to lost+found ...
Phase 7 - verify link counts...
- 05:54:54: verify and correct link counts - 16 of 16 allocation groups done
No modify flag set, skipping filesystem flush and exiting.# xfs_db -F -i -p xfs_check -c "check" /dev/mapper/xxxx-xfstest bad nblocks 2 for free inode 1028 block 0/549 type unknown not expected block 0/550 type unknown not expected
Quoted 123 lines
--D
Quoted 120 lines
Thanks,
Zorrocommon/rc | 1 + common/xfs | 26 ++++++++++++++++++++++++++ tests/generic/232 | 2 ++ tests/generic/233 | 2 ++ tests/generic/234 | 2 ++ tests/xfs/442 | 2 ++ 6 files changed, 35 insertions(+)common/rc +1
-0@@ -1570,6 +1570,7 @@ _require_scratch() { _require_scratch_nocheck touch ${RESULT_DIR}/require_scratch + touch ${RESULT_DIR}/require_scratch.xfs_check } # require a scratch dev of a minimum size (in kb)common/xfs +26
-0@@ -168,11 +168,37 @@ _scratch_mkfs_xfs() return $mkfs_status } +# Usage: _require_scratch_no_xfs_check [limit_memsize] +# +# Due to xfs_check costs too much memory, sometimes it cause OOM when test on +# low memory machine. This function is used to skip xfs_check conditionally +# or unconditionally. +# +# Note: must be called after _require_scratch. +_require_scratch_no_xfs_check() +{ + local bound=$1 + local freemem + + freemem=`_free_memory_bytes` + if [ -n "$bound" ];then + if [ $freemem -lt $bound ];then + rm -f ${RESULT_DIR}/require_scratch.xfs_check + fi + else + rm -f ${RESULT_DIR}/require_scratch.xfs_check + fi +} + # xfs_check script is planned to be deprecated. But, we want to # be able to invoke "xfs_check" behavior in xfstests in order to # maintain the current verification levels. _xfs_check() { + if [ ! -f "${RESULT_DIR}/require_scratch.xfs_check" ];then + return 0 + fi + OPTS=" " DBOPTS=" " USAGE="Usage: xfs_check [-fsvV] [-l logdev] [-i ino]... [-b bno]... special"tests/generic/232 +2
-0@@ -52,6 +52,8 @@ _fsstress() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _scratch_mkfs > $seqres.full 2>&1tests/generic/233 +2
-0@@ -56,6 +56,8 @@ _fsstress() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _require_usertests/generic/234 +2
-0@@ -72,6 +72,8 @@ test_setting() _supported_fs generic _supported_os Linux _require_scratch +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota # real QA test starts heretests/xfs/442 +2
-0@@ -36,6 +36,8 @@ _supported_fs xfs _supported_os Linux _require_scratch_reflink +# Do post xfs_check, if free memory size > 16G +_require_scratch_no_xfs_check $((16 * 1024 * 1024 * 1024)) _require_quota _require_command "$KILLALL_PROG" "killall"Signature · 1 line
2.17.2