path: root/tests
diff options
authorDavid Sterba <>2016-03-17 14:22:24 +0100
committerDavid Sterba <>2016-03-17 14:22:43 +0100
commit974d2ed5644a258d2b27fe28c989b36fb3bec75c (patch)
treea67f04fbce9f21c4a84308a11183d8ec7644965f /tests
parentcdd1bae4032619d3d3acec0d48c32955e3235d1e (diff)
btrfs-progs: tests: add 013-subvolume-sync-crash
Test for "btrfs-progs: subvol sync: fix memory corruption, undersized array", a lot of deleted subvolumes in the 'subvol sync' will not fit into the array, should result in a glibc report. Signed-off-by: David Sterba <>
Diffstat (limited to 'tests')
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/misc-tests/013-subvolume-sync-crash/ b/tests/misc-tests/013-subvolume-sync-crash/
new file mode 100755
index 00000000..c7955269
--- /dev/null
+++ b/tests/misc-tests/013-subvolume-sync-crash/
@@ -0,0 +1,49 @@
+# Verify that subovolume sync waits until the subvolume is cleaned and does not
+# crash at the end
+source $TOP/tests/common
+check_prereq mkfs.btrfs
+check_prereq btrfs
+run_check truncate -s 2G $IMAGE
+run_check $TOP/mkfs.btrfs -f $IMAGE
+run_check $SUDO_HELPER mount $IMAGE $TEST_MNT
+run_check $SUDO_HELPER chmod a+rw $TEST_MNT
+for i in `seq 5`; do
+ run_check dd if=/dev/zero of=file$i bs=1M count=10
+# 128 is minimum
+for sn in `seq 130`;do
+ run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot . snap$sn
+ for i in `seq 10`; do
+ run_check dd if=/dev/zero of=snap$sn/file$i bs=1M count=1
+ done
+run_check $SUDO_HELPER $TOP/btrfs subvolume list .
+run_check $SUDO_HELPER $TOP/btrfs subvolume list -d .
+idtodel=`run_check_stdout $SUDO_HELPER $TOP/btrfs inspect-internal rootid snap3`
+# delete, sync after some time
+run_check $SUDO_HELPER $TOP/btrfs subvolume delete -c snap*
+{ sleep 5; run_check $TOP/btrfs filesystem sync $TEST_MNT; } &
+run_check $SUDO_HELPER $TOP/btrfs subvolume sync .
+run_check $TOP/btrfs filesystem sync $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs subvolume list -d .
+cd ..
+run_check $SUDO_HELPER umount $TEST_MNT