common/xfs: refactor commands to select a particular xfs backing device
[xfstests-dev.git] / tests / xfs / 304
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 304
6 #
7 # Test to verify that turn group/project quotas off while user quotas
8 # are left on.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21     cd /
22     rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/quota
29
30 # Modify as appropriate.
31 _supported_fs xfs
32
33 _require_scratch
34 _require_xfs_quota
35 _require_xfs_mkfs_crc
36 _require_xfs_crc
37
38 rm -f $seqres.full
39 _scratch_mkfs_xfs -m crc=1 >/dev/null 2>&1
40
41 _qmount_option "uquota,gquota,pquota"
42 _qmount
43
44 QUOTA_DIR=$SCRATCH_MNT/quota_dir
45
46 mkdir -p $QUOTA_DIR
47 echo "*** turn off group quotas"
48 xfs_quota -x -c 'off -g' $SCRATCH_MNT
49 rmdir $QUOTA_DIR
50 echo "*** umount"
51 _scratch_unmount
52
53 _qmount
54 mkdir -p $QUOTA_DIR
55 echo "*** turn off project quotas"
56 xfs_quota -x -c 'off -p' $SCRATCH_MNT
57 rmdir $QUOTA_DIR
58 echo "*** umount"
59 _scratch_unmount
60
61 _qmount
62 mkdir -p $QUOTA_DIR
63 echo "*** turn off group/project quotas"
64 xfs_quota -x -c 'off -gp' $SCRATCH_MNT
65 rmdir $QUOTA_DIR
66 echo "*** umount"
67 _scratch_unmount
68
69 # success, all done
70 status=0
71 exit