5 # Use of "sync" mount option here is an attempt to get deterministic
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
46 s,$tmp.projects,[PROJECTS_FILE],;
47 s,$SCRATCH_MNT,[SCR_MNT],;
48 s,$SCRATCH_DEV,[SCR_DEV],;
49 s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
50 s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
55 _supported_os Linux #IRIX
59 # real QA test starts here
60 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
61 cat $tmp.mkfs >$seq.full
65 if [ -z "$MOUNT_OPTIONS" ]; then
66 export MOUNT_OPTIONS="-o pquota,sync"
68 export MOUNT_OPTIONS="$MOUNT_OPTIONS -o sync"
72 _require_prjquota $SCRATCH_DEV
74 echo "### create projects file"
76 target=$SCRATCH_MNT/project
77 echo "6:$target" | tee -a $seq.full > $tmp.projects
79 echo "### populate filesystem"
81 $FSSTRESS_PROG -z -s 65261 -m 8 -n 1000 -p 4 \
105 $FSSTRESS_PROG -z -s 47806 -m 8 -n 500 -p 4 \
111 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
113 echo "### initial report"
114 xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
116 echo "### check the project, should give warnings"
117 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
119 echo "### recursively setup the project"
120 xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
121 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
123 echo "### check the project, should give no warnings now"
124 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
126 echo "### deny a hard link - wrong project ID"
127 rm -f $SCRATCH_MNT/outer $target/inner
128 $XFS_IO_PROG -f -c 'chproj 789' $SCRATCH_MNT/outer
129 ln $SCRATCH_MNT/outer $target/inner 2>/dev/null
130 if [ $? -eq 0 ]; then
131 echo hard link succeeded
132 ls -ld $SCRATCH_MNT/outer $target/inner
134 echo hard link failed
136 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
138 echo "### allow a hard link - right project ID"
139 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
140 ln $SCRATCH_MNT/outer $target/inner
141 if [ $? -eq 0 ]; then
142 echo hard link succeeded
144 echo hard link failed
145 ls -ld $SCRATCH_MNT/outer $target/inner
147 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
149 echo "### recursively clear the project"
150 xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
152 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota