aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidong Yang <realwakka@gmail.com>2022-03-02 14:05:48 +0000
committerEryu Guan <guaneryu@gmail.com>2022-03-21 00:25:00 +0800
commit0d2a65f3239b8de1811522385741523e6e6c3edc (patch)
treebb76d170465809fcf4d994d24418f33c931c5b29
parente076938451cee0385fa8649c0e4630d4be261d71 (diff)
downloadxfstests-dev-0d2a65f3239b8de1811522385741523e6e6c3edc.tar.gz
btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly
Test enable/disable quota and create/destroy qgroup repeatedly in parallel and confirm it does not cause kernel hang. It only happens in kernel staring with kernel 5.17-rc3. This is a regression test for the problem reported to linux-btrfs list [1]. The hang was recreated using the test case and fixed by kernel patch titled btrfs: qgroup: fix deadlock between rescan worker and remove qgroup [1] https://lore.kernel.org/linux-btrfs/20220228014340.21309-1-realwakka@gmail.com/ Signed-off-by: Sidong Yang <realwakka@gmail.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rwxr-xr-xtests/btrfs/26238
-rw-r--r--tests/btrfs/262.out2
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/btrfs/262 b/tests/btrfs/262
new file mode 100755
index 0000000000..d58afa461f
--- /dev/null
+++ b/tests/btrfs/262
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Sidong Yang. All Rights Reserved.
+#
+# FS QA Test 262
+#
+# Test that running qgroup enable, create, destroy, and disable commands in
+# parallel doesn't result in a deadlock, a crash or any filesystem
+# inconsistency.
+#
+. ./common/preamble
+_begin_fstest auto quick qgroup
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+
+_supported_fs btrfs
+
+_require_scratch
+
+_scratch_mkfs > /dev/null 2>&1
+_scratch_mount
+
+for ((i = 0; i < 200; i++)); do
+ $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT 2>> $seqres.full &
+ $BTRFS_UTIL_PROG qgroup create 1/0 $SCRATCH_MNT 2>> $seqres.full &
+ $BTRFS_UTIL_PROG qgroup destroy 1/0 $SCRATCH_MNT 2>> $seqres.full &
+ $BTRFS_UTIL_PROG quota disable $SCRATCH_MNT 2>> $seqres.full &
+done
+
+wait
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/262.out b/tests/btrfs/262.out
new file mode 100644
index 0000000000..404badc3be
--- /dev/null
+++ b/tests/btrfs/262.out
@@ -0,0 +1,2 @@
+QA output created by 262
+Silence is golden