2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
8 # Use of "sync" mount option here is an attempt to get deterministic
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 # get standard environment, filters and checks
29 s,$tmp.projects,[PROJECTS_FILE],;
30 s,$SCRATCH_MNT,[SCR_MNT],;
31 s,$SCRATCH_DEV,[SCR_DEV],;
32 s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
33 s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
41 # real QA test starts here
42 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
43 cat $tmp.mkfs >$seqres.full
47 if [ -z "$MOUNT_OPTIONS" ]; then
48 export MOUNT_OPTIONS="-o pquota,sync"
50 export MOUNT_OPTIONS="$MOUNT_OPTIONS -o sync"
54 _require_prjquota $SCRATCH_DEV
56 echo "### create projects file"
58 target=$SCRATCH_MNT/project
59 echo "6:$target" | tee -a $seqres.full > $tmp.projects
61 echo "### populate filesystem"
63 $FSSTRESS_PROG -z -s 65261 -m 8 -n 1000 -p 4 \
87 $FSSTRESS_PROG -z -s 47806 -m 8 -n 500 -p 4 \
92 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
94 echo "### initial report"
95 xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
97 echo "### check the project, should give warnings"
98 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
100 echo "### recursively setup the project"
101 xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
102 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
104 echo "### check the project, should give no warnings now"
105 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
107 echo "### deny a hard link - wrong project ID"
108 rm -f $SCRATCH_MNT/outer $target/inner
109 $XFS_IO_PROG -f -c 'chproj 789' $SCRATCH_MNT/outer
110 ln $SCRATCH_MNT/outer $target/inner 2>/dev/null
111 if [ $? -eq 0 ]; then
112 echo hard link succeeded
113 ls -ld $SCRATCH_MNT/outer $target/inner
115 echo hard link failed
117 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
119 echo "### allow a hard link - right project ID"
120 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
121 ln $SCRATCH_MNT/outer $target/inner
122 if [ $? -eq 0 ]; then
123 echo hard link succeeded
125 echo hard link failed
126 ls -ld $SCRATCH_MNT/outer $target/inner
128 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
130 echo "### recursively clear the project"
131 xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
133 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota