From 2f734d7b2c0eac59969f5c5137e4a0c87d504c0e Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Mon, 17 Jan 2022 10:38:50 +0800 Subject: [PATCH] btrfs-progs: tests/fsck: add test image with invalid metadata backref level The image has a key in extent tree, (30457856 METADATA_ITEM 256), which has invalid level (256 > BTRFS_MAX_LEVEL). Make sure check can at least detect such problem. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- .../053-bad-metadata-level/default.img.xz | Bin 0 -> 2084 bytes .../fsck-tests/053-bad-metadata-level/test.sh | 19 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/fsck-tests/053-bad-metadata-level/default.img.xz create mode 100755 tests/fsck-tests/053-bad-metadata-level/test.sh diff --git a/tests/fsck-tests/053-bad-metadata-level/default.img.xz b/tests/fsck-tests/053-bad-metadata-level/default.img.xz new file mode 100644 index 0000000000000000000000000000000000000000..d7debee7b7c2bb457dbe734da2429859245770ae GIT binary patch literal 2084 zcmV+<2;2AlH+ooF000E$*0e?f03iV!0000G&sfah5B~?`T>wRyj;C3^v%$$4d1r37 zhA1?^)Fb!kgA6~+!%84I;Io073Dhl?^BD<@UPMs(i~SGmBKxebUa%|NH;s2ul#JQO zdsro>jHw^5Bn(Nv<#H=CdIZ2*)=~SDhF_~|WjY(kiko@U%p+|l?;k=gV%ewSRP-|S z?BE&UdM?8uB)@>{L_lap2__bX+WIXj=6NJFb{;4 zz#!|S8#)thnJ#~l-e*7Y-goW)P>h7W+=mEq$8A&?H zH>VhM_aZ&@;FbBmPB)>)g2mb2qvObjw*ZeQ9)7yHYRr5WjlBO9>59Fq0p&tpKru@f zSnEL^6r~r?Q_<^#k1o6r6Qzl`u*m{O2d7%B%MAdye)uA;xUv)+*U`Fk07{dZ5O7~4J0&dbG@d!q__B~HGD_X)Nv#wiD)Z5|8b&4_OaJnzjnRrFBkva0eP7wOc= z9k|7%(g#V`NW1Yi2V~W3!(t@viUZ*Y_iFH`KUC%2OEwQ6$={D1p1d65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tV?}-gg({DJSFzG0)SHMTQspmtd0P3-IOD zp)D^?z^Yff_S;;5O8?0xps49sGvmgT#QXG#*C`lb0hF7-5m$Pj9_5$iIr(*ABrqHPM>KGPBeVjxBy${Sg}ssw3uEf@ ze$O}l^tEbM-B&v2(o%T6BVHOLU$;pf#aIHdQ2+o8$#zZUQHkUL0e}#IAOHYdrx9qe O#Ao{g000001X)_pOZyN2 literal 0 HcmV?d00001 diff --git a/tests/fsck-tests/053-bad-metadata-level/test.sh b/tests/fsck-tests/053-bad-metadata-level/test.sh new file mode 100755 index 00000000..0ffd7bdf --- /dev/null +++ b/tests/fsck-tests/053-bad-metadata-level/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Verify that check can detect invalid metadata backref level. +# +# There is a report that btrfs-check original mode doesn't report invalid +# metadata backref level, and lowmem mode would just crash. +# +# Make sure btrfs check can at least detect such error. + +source "$TEST_TOP/common" + +check_prereq btrfs + +check_image() { + run_mustfail "invalid metadata backref level not detected" \ + "$TOP/btrfs" check "$1" +} + +check_all_images