btrfs-progs: tests: test multiple-linked file corruption

This commit extends the leaf corruption test to try to repair a file
linked from multiple directory. It stresses a case that some links to a
file is broken but others kept valid.

Signed-off-by: Naohiro Aota <naota@elisp.net>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Naohiro Aota 2015-12-08 11:07:13 +09:00 committed by David Sterba
parent 9c572c38a1
commit ebb66f20ae
2 changed files with 7 additions and 4 deletions

View File

@ -29,6 +29,7 @@ leaf_no_data_ext_list=(
1869 0 40700 "snmp"
1871 0 100700 "machine-id"
1872 0 100700 "adjtime"
1877 0 40700 "del"
)
generate_leaf_corrupt_no_data_ext()
@ -40,10 +41,12 @@ generate_leaf_corrupt_no_data_ext()
$TOP/btrfs-image -r test.img.btrfs-image $dest || \
_fail "failed to extract leaf_corrupt_no_data_ext.btrfs-image"
# leaf at 20832256 contains no regular data extent, clear its csum to
# corrupt the leaf.
dd if=/dev/zero of=$dest bs=1 count=32 conv=notrunc seek=20832256 \
# leaf at 4206592 and 20905984 contains no regular data
# extent, clear its csum to corrupt the leaf.
for x in 4206592 20905984; do
dd if=/dev/zero of=$dest bs=1 count=32 conv=notrunc seek=$x \
1>/dev/null 2>&1
done
}
check_inode()