public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly
@ 2022-03-02 14:05 Sidong Yang
  2022-03-02 15:22 ` Filipe Manana
  2022-03-03  0:51 ` Shinichiro Kawasaki
  0 siblings, 2 replies; 3+ messages in thread
From: Sidong Yang @ 2022-03-02 14:05 UTC (permalink / raw)
  To: linux-btrfs, fstests
  Cc: Sidong Yang, Filipe Manana, Shinichiro Kawasaki, dsterba@suse.cz

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>
---
v2 : fix changelog, comments, no wait pids argument
---
 tests/btrfs/262     | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/262.out |  2 ++
 2 files changed, 42 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..8953a28e
--- /dev/null
+++ b/tests/btrfs/262
@@ -0,0 +1,40 @@
+#! /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
+
+_scratch_unmount
+
+# 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] 3+ messages in thread

* Re: [PATCH v2] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly
  2022-03-02 14:05 [PATCH v2] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly Sidong Yang
@ 2022-03-02 15:22 ` Filipe Manana
  2022-03-03  0:51 ` Shinichiro Kawasaki
  1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2022-03-02 15:22 UTC (permalink / raw)
  To: Sidong Yang; +Cc: linux-btrfs, fstests, Shinichiro Kawasaki, dsterba@suse.cz

On Wed, Mar 02, 2022 at 02:05:48PM +0000, Sidong Yang wrote:
> 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>
> ---
> v2 : fix changelog, comments, no wait pids argument
> ---
>  tests/btrfs/262     | 40 ++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/262.out |  2 ++
>  2 files changed, 42 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..8953a28e
> --- /dev/null
> +++ b/tests/btrfs/262
> @@ -0,0 +1,40 @@
> +#! /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
> +
> +_scratch_unmount

The fstests framework will also do the unmount, so this can be removed.
You don't need to send a new patch version just to remove that, Eryu
can probably amend the patch when he picks it up.

Anyway, it looks good and it works as expected.

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Thanks for making the test case.

> +
> +# 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	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly
  2022-03-02 14:05 [PATCH v2] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly Sidong Yang
  2022-03-02 15:22 ` Filipe Manana
@ 2022-03-03  0:51 ` Shinichiro Kawasaki
  1 sibling, 0 replies; 3+ messages in thread
From: Shinichiro Kawasaki @ 2022-03-03  0:51 UTC (permalink / raw)
  To: Sidong Yang
  Cc: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	Filipe Manana, dsterba@suse.cz

On Mar 02, 2022 / 14:05, Sidong Yang wrote:
> 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>

As Filipe noted, _scratch_unmount can be removed. Other than that, it looks good
to me. Thanks again for catching this!

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

-- 
Best Regards,
Shin'ichiro Kawasaki


> ---
> v2 : fix changelog, comments, no wait pids argument
> ---
>  tests/btrfs/262     | 40 ++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/262.out |  2 ++
>  2 files changed, 42 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..8953a28e
> --- /dev/null
> +++ b/tests/btrfs/262
> @@ -0,0 +1,40 @@
> +#! /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
> +
> +_scratch_unmount
> +
> +# 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	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-03  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-02 14:05 [PATCH v2] btrfs: add test for enable/disable quota and create/destroy qgroup repeatedly Sidong Yang
2022-03-02 15:22 ` Filipe Manana
2022-03-03  0:51 ` Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox