All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly
@ 2022-03-01 15:19 Sidong Yang
  2022-03-02  4:43 ` Shinichiro Kawasaki
  2022-03-02 12:10 ` Filipe Manana
  0 siblings, 2 replies; 8+ messages in thread
From: Sidong Yang @ 2022-03-01 15:19 UTC (permalink / raw)
  To: linux-btrfs, fstests
  Cc: Sidong Yang, Shinichiro Kawasaki, Filipe Manana, dsterba

Test enabling/disable quota and creating/destroying qgroup repeatedly
in asynchronous and confirm it does not cause kernel hang. 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>
---
 tests/btrfs/262     | 54 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/262.out |  2 ++
 2 files changed, 56 insertions(+)
 create mode 100755 tests/btrfs/262
 create mode 100644 tests/btrfs/262.out

diff --git a/tests/btrfs/262 b/tests/btrfs/262
new file mode 100755
index 00000000..9be380f9
--- /dev/null
+++ b/tests/btrfs/262
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 YOUR NAME HERE.  All Rights Reserved.
+#
+# FS QA Test 262
+#
+# Test the deadlock between qgroup and quota commands
+#
+. ./common/preamble
+_begin_fstest auto qgroup
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs btrfs
+
+_require_scratch
+
+# Run command that enable/disable quota and create/destroy qgroup asynchronously
+qgroup_deadlock_test()
+{
+	_scratch_mkfs > /dev/null 2>&1
+	_scratch_mount
+	echo "=== qgroup deadlock test ===" >> $seqres.full
+
+	pids=()
+	for ((i = 0; i < 200; i++)); do
+		$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT 2>> $seqres.full &
+		pids+=($!)
+		$BTRFS_UTIL_PROG qgroup create 1/0 $SCRATCH_MNT 2>> $seqres.full &
+		pids+=($!)
+		$BTRFS_UTIL_PROG qgroup destroy 1/0 $SCRATCH_MNT 2>> $seqres.full &
+		pids+=($!)
+		$BTRFS_UTIL_PROG quota disable $SCRATCH_MNT 2>> $seqres.full &
+		pids+=($!)		
+	done
+
+	for pid in "${pids[@]}"; do
+		wait $pid
+	done
+
+	_scratch_unmount
+	_check_scratch_fs
+}
+
+qgroup_deadlock_test
+
+# 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 00000000..404badc3
--- /dev/null
+++ b/tests/btrfs/262.out
@@ -0,0 +1,2 @@
+QA output created by 262
+Silence is golden
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-02 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 15:19 [PATCH] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly Sidong Yang
2022-03-02  4:43 ` Shinichiro Kawasaki
2022-03-02  6:26   ` Sidong Yang
2022-03-02  8:24     ` Shinichiro Kawasaki
2022-03-02 13:47       ` Sidong Yang
2022-03-02 12:10 ` Filipe Manana
2022-03-02 13:43   ` Sidong Yang
2022-03-02 15:12     ` Filipe Manana

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.