generic: test the deadlock between the AGI and AGF with RENAME_WHITEOUT
authorkaixuxia <xiakaixu1987@gmail.com>
Thu, 31 Oct 2019 06:41:49 +0000 (14:41 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 2 Nov 2019 05:56:51 +0000 (13:56 +0800)
There is ABBA deadlock bug in XFS between the AGI and AGF when
performing rename() with RENAME_WHITEOUT flag, and add this testcase
to make sure the rename() call works well.

Though this is a xfs-specific bug, the reproducer has no
xfs-specific part.

Signed-off-by: kaixuxia <kaixuxia@tencent.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/585 [new file with mode: 0755]
tests/generic/585.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/585 b/tests/generic/585
new file mode 100755 (executable)
index 0000000..f815da5
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 Tencent.  All Rights Reserved.
+#
+# FS QA Test No. 585
+#
+# 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 150 -p 100 \
+               -f mknod=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/585.out b/tests/generic/585.out
new file mode 100644 (file)
index 0000000..e4dd43b
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 585
+Silence is golden
index 42ca2b911a8604b354f89c28c42f954355a61b3c..e5d0c1da9d4bd38625ec70ec449248006663762f 100644 (file)
 582 auto quick encrypt
 583 auto quick encrypt
 584 auto quick encrypt
+585 auto rename