path: root/tests/fsck-tests
diff options
authorQu Wenruo <>2017-02-21 16:34:36 +0800
committerDavid Sterba <>2017-03-08 13:00:49 +0100
commitcbaa289d3d1350a7aad8f3f96df2b66ffeaa9155 (patch)
treea42c1d636919e13996a96ada7caf5cea1520dfcc /tests/fsck-tests
parent381b43a0201e78049f11e8ededd251a930cbaeb8 (diff)
btrfs-progs: tests: Add new test case for file extent false alerts
Lowmem mode exposed several false alerts, all related to file extents check. 1) Partly written prealloc extent Cause lowmem mode to report missing csum or prealloc extent should not have csum 2) Compressed inline extent Cause lowmem mode to find mismatch on inline len and item len. While no error message is output but exit silently. Reported-by: Chris Murphy <> Reported-by: Christoph Anton Mitterer <> Signed-off-by: Qu Wenruo <> Signed-off-by: David Sterba <>
Diffstat (limited to 'tests/fsck-tests')
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/fsck-tests/025-file-extents/ b/tests/fsck-tests/025-file-extents/
new file mode 100755
index 00000000..cb64c500
--- /dev/null
+++ b/tests/fsck-tests/025-file-extents/
@@ -0,0 +1,42 @@
+# Confirm btrfs check can check file extents without causing false alert
+source $TOP/tests/common
+check_prereq btrfs
+check_prereq mkfs.btrfs
+check_global_prereq xfs_io
+check_global_prereq fallocate
+prepare_test_dev 128M
+# Do some write into a large prealloc range
+# Lowmem mode can report missing csum due to wrong csum range
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
+ run_check_mount_test_dev
+ run_check fallocate -l 128K "$TEST_MNT/file"
+ sync
+ run_check xfs_io -c "pwrite 0 64K" "$TEST_MNT/file"
+ run_check_umount_test_dev
+ run_check "$TOP/btrfs" check "$TEST_DEV"
+# Inline compressed file extent
+# Lowmem mode can cause silent error without any error message
+# due to too restrict check on inline extent size
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
+ run_check_mount_test_dev -o compress=lzo,max_inline=2048
+ run_check xfs_io -f -c "pwrite 0 1K" "$TEST_MNT/file"
+ run_check_umount_test_dev
+ run_check "$TOP/btrfs" check "$TEST_DEV"