common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
[xfstests-dev.git] / tests / generic / 566
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0+
3 # Copyright (c) 2019, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 566
6 #
7 # Regression test for chgrp returning to userspace with ILOCK held after a hard
8 # quota error. This causes the filesystem to hang if kernel is not patched.
9 #
10 # This test goes with commit 1fb254aa983bf ("xfs: fix missing ILOCK unlock when
11 # xfs_setattr_nonsize fails due to EDQUOT")
12
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1    # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24         cd /
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/quota
30 . ./common/filter
31
32 # real QA test starts here
33 _supported_os Linux
34 _supported_fs generic
35 _require_scratch
36 _require_quota
37 _require_xfs_quota_foreign
38 _require_user
39
40 rm -f $seqres.full
41
42 _qmount_option "grpquota"
43 _scratch_mkfs > $seqres.full
44 _qmount
45
46 dir="$SCRATCH_MNT/dummy"
47 mkdir -p $dir
48 chown $qa_user $dir
49 $XFS_QUOTA_PROG -x -c "limit -g bsoft=100k bhard=100k $qa_user" $SCRATCH_MNT
50
51 $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m' $dir/foo >> $seqres.full
52 chown $qa_user "${dir}/foo"
53 _user_do "chgrp $qa_user ${dir}/foo" 2>&1 | _filter_scratch
54 ls -la ${dir} >> $seqres.full
55 $XFS_QUOTA_PROG -x -c 'report -hag' $SCRATCH_MNT >> $seqres.full
56
57 # success, all done
58 status=0
59 exit