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)/;
42 # real QA test starts here
43 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
44 cat $tmp.mkfs >$seqres.full
48 if [ -z "$MOUNT_OPTIONS" ]; then
49 export MOUNT_OPTIONS="-o pquota,sync"
51 export MOUNT_OPTIONS="$MOUNT_OPTIONS -o sync"
55 _require_prjquota $SCRATCH_DEV
57 echo "### create projects file"
59 target=$SCRATCH_MNT/project
60 echo "6:$target" | tee -a $seqres.full > $tmp.projects
62 echo "### populate filesystem"
64 $FSSTRESS_PROG -z -s 65261 -m 8 -n 1000 -p 4 \
88 $FSSTRESS_PROG -z -s 47806 -m 8 -n 500 -p 4 \
93 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
95 echo "### initial report"
96 xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
98 echo "### check the project, should give warnings"
99 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
101 echo "### recursively setup the project"
102 xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
103 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
105 echo "### check the project, should give no warnings now"
106 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
108 echo "### deny a hard link - wrong project ID"
109 rm -f $SCRATCH_MNT/outer $target/inner
110 $XFS_IO_PROG -f -c 'chproj 789' $SCRATCH_MNT/outer
111 ln $SCRATCH_MNT/outer $target/inner 2>/dev/null
112 if [ $? -eq 0 ]; then
113 echo hard link succeeded
114 ls -ld $SCRATCH_MNT/outer $target/inner
116 echo hard link failed
118 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
120 echo "### allow a hard link - right project ID"
121 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
122 ln $SCRATCH_MNT/outer $target/inner
123 if [ $? -eq 0 ]; then
124 echo hard link succeeded
126 echo hard link failed
127 ls -ld $SCRATCH_MNT/outer $target/inner
129 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
131 echo "### recursively clear the project"
132 xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
134 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota