btrfs-progs: fsck-test: case for corrupted dir item name
authorSu Yue <suy.fnst@cn.fujitsu.com>
Fri, 14 Jul 2017 07:47:46 +0000 (15:47 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 24 Aug 2017 17:07:58 +0000 (19:07 +0200)
In this test case, all name in dir_item, dir_index, inode_ref
are corrupted to another one.
btrfs check should report errors about the corrupted dir_item but
btrfs can't repair the case now.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
tests/fsck-tests/026-bad-dir-item-name/default_case.img.xz [new file with mode: 0644]
tests/fsck-tests/026-bad-dir-item-name/test.sh [new file with mode: 0755]

diff --git a/tests/fsck-tests/026-bad-dir-item-name/default_case.img.xz b/tests/fsck-tests/026-bad-dir-item-name/default_case.img.xz
new file mode 100644 (file)
index 0000000..27e8553
Binary files /dev/null and b/tests/fsck-tests/026-bad-dir-item-name/default_case.img.xz differ
diff --git a/tests/fsck-tests/026-bad-dir-item-name/test.sh b/tests/fsck-tests/026-bad-dir-item-name/test.sh
new file mode 100755 (executable)
index 0000000..a1077a8
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+#
+# confirm whether check detects name and hash mismatch in dir_item
+
+source "$TOP/tests/common"
+
+check_prereq btrfs
+
+image=$(extract_image "./default_case.img.xz")
+
+run_mustfail "dir_item hash mismatch not found" "$TOP/btrfs" check "$image"
+
+rm -f "$image"