generic: test for failure to unlock inode after chgrp fails with EDQUOT
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 27 Aug 2019 15:08:50 +0000 (08:08 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sat, 31 Aug 2019 15:47:24 +0000 (23:47 +0800)
This is a regression test that checks for xfs drivers that fail to
unlock the inode after changing the group id fails with EDQUOT.  It
pairs with "xfs: fix missing ILOCK unlock when xfs_setattr_nonsize fails
due to EDQUOT".

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/566 [new file with mode: 0755]
tests/generic/566.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/566 b/tests/generic/566
new file mode 100755 (executable)
index 0000000..e8491e5
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test No. 566
+#
+# Regression test for chgrp returning to userspace with ILOCK held after a hard
+# quota error. This causes the filesystem to hang if kernel is not patched.
+#
+# This test goes with commit 1fb254aa983bf ("xfs: fix missing ILOCK unlock when
+# xfs_setattr_nonsize fails due to EDQUOT")
+
+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 /
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/quota
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs generic
+_require_scratch
+_require_quota
+_require_user
+
+rm -f $seqres.full
+
+_qmount_option "grpquota"
+_scratch_mkfs > $seqres.full
+_qmount
+
+dir="$SCRATCH_MNT/dummy"
+mkdir -p $dir
+chown $qa_user $dir
+$XFS_QUOTA_PROG -x -f -c "limit -g bsoft=100k bhard=100k $qa_user" $SCRATCH_MNT
+
+$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m' $dir/foo >> $seqres.full
+chown $qa_user "${dir}/foo"
+_user_do "chgrp $qa_user ${dir}/foo" 2>&1 | _filter_scratch
+ls -la ${dir} >> $seqres.full
+$XFS_QUOTA_PROG -x -f -c 'report -hag' $SCRATCH_MNT >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/566.out b/tests/generic/566.out
new file mode 100644 (file)
index 0000000..0005e89
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 566
+chgrp: changing group of 'SCRATCH_MNT/dummy/foo': Disk quota exceeded
index 2e4a6f79276bd23f559f9467c1054cacc967660f..d26c080fde30f5040e02ed3bd84f2e6fa496bb7c 100644 (file)
 563 auto quick
 564 auto quick copy_range
 565 auto quick copy_range
+566 auto quick quota metadata