6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
21 # get standard environment, filters and checks
30 s,$tmp.projects,[PROJECTS_FILE],;
31 s,$SCRATCH_MNT,[SCR_MNT],;
32 s,$SCRATCH_DEV,[SCR_DEV],;
33 s/Inode: \#\d+ \(0 blocks, 0 extents\)/Inode: #[INO] (0 blocks, 0 extents)/;
34 s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
39 _supported_os Linux #IRIX
44 # real QA test starts here
45 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
46 cat $tmp.mkfs >$seq.full
50 [ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o pquota"
53 src/feature -p $SCRATCH_MNT && _notrun "Cannot run without project quota"
55 echo "### create projects file"
57 target=$SCRATCH_MNT/project
58 echo "6:$target" | tee -a $seq.full > $tmp.projects
60 echo "### populate filesystem"
62 FSSTRESS_AVOID="$FSSTRESS_AVOID -fmknod=0 -fsymlink=0"
63 ltp/fsstress -s 0xfeed -m8 -w -p4 -n1000 $FSSTRESS_AVOID -d $target
64 ltp/fsstress -s 0xbabe -m8 -z -p4 -n500 -fchproj=250 -fchown=250 -d $target
66 QARGS="-x -D $tmp.projects -P /dev/null $SCRATCH_MNT"
68 echo "### initial report"
69 xfs_quota -c 'quot -p' -c 'quota -ip 6' $QARGS | filter_xfs_quota
71 echo "### check the project, should give warnings"
72 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
74 echo "### recursively setup the project"
75 xfs_quota -c 'project -s 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
76 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
78 echo "### check the project, should give no warnings now"
79 xfs_quota -c 'project -c 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
81 echo "### deny a hard link - wrong project ID"
82 rm -f $SCRATCH_MNT/outer $target/inner
83 $XFS_IO_PROG -f -c 'chproj 789' $SCRATCH_MNT/outer
84 ln $SCRATCH_MNT/outer $target/inner 2>/dev/null
86 echo hard link succeeded
87 ls -ld $SCRATCH_MNT/outer $target/inner
91 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
93 echo "### allow a hard link - right project ID"
94 $XFS_IO_PROG -c 'chproj 6' $SCRATCH_MNT/outer
95 ln $SCRATCH_MNT/outer $target/inner
97 echo hard link succeeded
100 ls -ld $SCRATCH_MNT/outer $target/inner
102 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota
104 echo "### recursively clear the project"
105 xfs_quota -c 'project -C 6' $QARGS | LC_COLLATE=POSIX sort | filter_xfs_quota
107 xfs_quota -c 'quota -ip 6' $QARGS | filter_xfs_quota