fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] xfs: test the deadlock between the AGI and AGF with RENAME_WHITEOUT
@ 2019-10-17  9:40 kaixuxia
  2019-10-17 11:49 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: kaixuxia @ 2019-10-17  9:40 UTC (permalink / raw)
  To: fstests
  Cc: linux-xfs, Eryu Guan, Darrick J. Wong, Brian Foster, newtongao,
	jasperwang

There is ABBA deadlock bug between the AGI and AGF when performing
rename() with RENAME_WHITEOUT flag, and add this testcase to make
sure the rename() call works well.

Signed-off-by: kaixuxia <kaixuxia@tencent.com>
---
 tests/generic/579     | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/579.out |  2 ++
 tests/generic/group   |  1 +
 3 files changed, 59 insertions(+)
 create mode 100755 tests/generic/579
 create mode 100644 tests/generic/579.out

diff --git a/tests/generic/579 b/tests/generic/579
new file mode 100755
index 0000000..d6b0042
--- /dev/null
+++ b/tests/generic/579
@@ -0,0 +1,56 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 Tencent.  All Rights Reserved.
+#
+# FS QA Test No. 579
+#
+# Regression test for:
+#    bc56ad8c74b8: ("xfs: Fix deadlock between AGI and AGF with RENAME_WHITEOUT")
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1        # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+        cd /
+        rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/renameat2
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs generic
+_require_scratch
+_require_renameat2 whiteout
+
+_scratch_mkfs > $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mount >> $seqres.full 2>&1
+
+# start a create and rename(rename_whiteout) workload. These processes
+# occur simultaneously may cause the deadlock between AGI and AGF with
+# RENAME_WHITEOUT.
+$FSSTRESS_PROG -z -n 100 -p 100 \
+		-f creat=5 \
+		-f rwhiteout=5 \
+		-d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
+
+echo Silence is golden
+
+# Failure comes in the form of a deadlock.
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/579.out b/tests/generic/579.out
new file mode 100644
index 0000000..06f4633
--- /dev/null
+++ b/tests/generic/579.out
@@ -0,0 +1,2 @@
+QA output created by 579
+Silence is golden
diff --git a/tests/generic/group b/tests/generic/group
index 6f9c4e1..21870d2 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -581,3 +581,4 @@
 576 auto quick verity encrypt
 577 auto quick verity
 578 auto quick rw clone
+579 auto rename
-- 
1.8.3.1

-- 
kaixuxia

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

* Re: [PATCH RFC] xfs: test the deadlock between the AGI and AGF with RENAME_WHITEOUT
  2019-10-17  9:40 [PATCH RFC] xfs: test the deadlock between the AGI and AGF with RENAME_WHITEOUT kaixuxia
@ 2019-10-17 11:49 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2019-10-17 11:49 UTC (permalink / raw)
  To: kaixuxia
  Cc: fstests, linux-xfs, Eryu Guan, Darrick J. Wong, newtongao, jasperwang

On Thu, Oct 17, 2019 at 05:40:51PM +0800, kaixuxia wrote:
> There is ABBA deadlock bug between the AGI and AGF when performing
> rename() with RENAME_WHITEOUT flag, and add this testcase to make
> sure the rename() call works well.
> 
> Signed-off-by: kaixuxia <kaixuxia@tencent.com>
> ---

This runs in about 5-7s on my VM and reproduced the deadlock on the
first try with the kernel fix reverted. Very nice. Thanks for working
this into a cleaner test!

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  tests/generic/579     | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/579.out |  2 ++
>  tests/generic/group   |  1 +
>  3 files changed, 59 insertions(+)
>  create mode 100755 tests/generic/579
>  create mode 100644 tests/generic/579.out
> 
> diff --git a/tests/generic/579 b/tests/generic/579
> new file mode 100755
> index 0000000..d6b0042
> --- /dev/null
> +++ b/tests/generic/579
> @@ -0,0 +1,56 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2019 Tencent.  All Rights Reserved.
> +#
> +# FS QA Test No. 579
> +#
> +# Regression test for:
> +#    bc56ad8c74b8: ("xfs: Fix deadlock between AGI and AGF with RENAME_WHITEOUT")
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1        # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +        cd /
> +        rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/renameat2
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_os Linux
> +_supported_fs generic
> +_require_scratch
> +_require_renameat2 whiteout
> +
> +_scratch_mkfs > $seqres.full 2>&1 || _fail "mkfs failed"
> +_scratch_mount >> $seqres.full 2>&1
> +
> +# start a create and rename(rename_whiteout) workload. These processes
> +# occur simultaneously may cause the deadlock between AGI and AGF with
> +# RENAME_WHITEOUT.
> +$FSSTRESS_PROG -z -n 100 -p 100 \
> +		-f creat=5 \
> +		-f rwhiteout=5 \
> +		-d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
> +
> +echo Silence is golden
> +
> +# Failure comes in the form of a deadlock.
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/579.out b/tests/generic/579.out
> new file mode 100644
> index 0000000..06f4633
> --- /dev/null
> +++ b/tests/generic/579.out
> @@ -0,0 +1,2 @@
> +QA output created by 579
> +Silence is golden
> diff --git a/tests/generic/group b/tests/generic/group
> index 6f9c4e1..21870d2 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -581,3 +581,4 @@
>  576 auto quick verity encrypt
>  577 auto quick verity
>  578 auto quick rw clone
> +579 auto rename
> -- 
> 1.8.3.1
> 
> -- 
> kaixuxia

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

end of thread, other threads:[~2019-10-17 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17  9:40 [PATCH RFC] xfs: test the deadlock between the AGI and AGF with RENAME_WHITEOUT kaixuxia
2019-10-17 11:49 ` Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).