6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of version 2 of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim of any third person regarding infringement
19 # or the like. Any license provided herein, whether implied or
20 # otherwise, applies only to this software file. Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA 94043, or:
33 # For further information regarding this notice, see:
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
42 echo "QA output created by $seq"
46 status=1 # failure is the default!
47 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
49 # get standard environment, filters and checks
58 s,$tmp.projects,[PROJECTS_FILE],;
59 s,$SCRATCH_MNT,[SCR_MNT],;
60 s,$SCRATCH_DEV,[SCR_DEV],;
61 s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
62 s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
67 _supported_os Linux #IRIX
72 # real QA test starts here
73 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
74 cat $tmp.mkfs >$seq.full
78 [ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o pquota"
81 src/feature -p $SCRATCH_MNT && _notrun "Cannot run without project quota"
83 echo "### create projects file"
85 target=$SCRATCH_MNT/project
86 echo "6:$target" | tee -a $seq.full > $tmp.projects
88 echo "### populate filesystem"
90 FSSTRESS_AVOID="$FSSTRESS_AVOID -fmknod=0 -fsymlink=0"
91 ltp/fsstress -s 0xfeed -m8 -w -p4 -n1000 $FSSTRESS_AVOID -d $target
92 ltp/fsstress -s 0xbabe -m8 -z -p4 -n500 -fchproj=250 -fchown=250 -d $target
94 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
96 echo "### initial report"
97 xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
99 echo "### check the project, should give warnings"
100 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
102 echo "### recursively setup the project"
103 xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
104 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
106 echo "### check the project, should give no warnings now"
107 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
109 echo "### deny a hard link - wrong project ID"
110 rm -f $SCRATCH_MNT/outer $target/inner
111 $XFS_IO_PROG -f -c 'chproj 789' $SCRATCH_MNT/outer
112 ln $SCRATCH_MNT/outer $target/inner 2>/dev/null
113 if [ $? -eq 0 ]; then
114 echo hard link succeeded
115 ls -ld $SCRATCH_MNT/outer $target/inner
117 echo hard link failed
119 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
121 echo "### allow a hard link - right project ID"
122 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
123 ln $SCRATCH_MNT/outer $target/inner
124 if [ $? -eq 0 ]; then
125 echo hard link succeeded
127 echo hard link failed
128 ls -ld $SCRATCH_MNT/outer $target/inner
130 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
132 echo "### recursively clear the project"
133 xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
135 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota