pv 955274 - Limit the offset passed to dm_write_invis() to the file size to avoid
[xfstests-dev.git] / 134
1 #! /bin/sh
2 # FS QA Test No. 134
3 #
4 # test to reproduce PV951636:
5 #   project quotas not updated if a file is mv'd into that directory
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
9 #-----------------------------------------------------------------------
10 #
11 # creator
12 owner=allanr@sgi.com
13
14 seq=`basename $0`
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20
21 # get standard environment, filters and checks
22 . ./common.rc
23 . ./common.filter
24 . ./common.quota
25
26 _cleanup()
27 {
28         cd /
29         umount $SCRATCH_MNT 2>/dev/null
30         rm -f $tmp.*
31 }
32 #trap "_cleanup; exit \$status" 0 1 2 3 15
33
34
35 # real QA test starts here
36 _supported_fs xfs
37 _supported_os Linux IRIX
38
39 dir=$SCRATCH_MNT/project
40
41 #project quota files
42 cat >$tmp.projects <<EOF
43 1:$dir
44 EOF
45
46 cat >$tmp.projid <<EOF
47 test:1
48 EOF
49
50 cp /dev/null $seq.full
51 chmod a+rwx $seq.full   # arbitrary users will write here
52
53 _require_scratch
54 _scratch_mkfs_xfs >/dev/null 2>&1
55
56 if ! _scratch_mount "-o pquota" >$tmp.out 2>&1
57 then
58     cat $tmp.out
59     echo "!!! mount failed"
60     exit
61 fi
62
63 src/feature -p $SCRATCH_DEV
64 [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
65
66
67 mkdir $dir
68 $XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
69
70 xfs_quota -D $tmp.projects -P $tmp.projid -x \
71     -c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
72 xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
73 touch $dir/1
74 touch $dir/2
75 cp $dir/2 $dir/3
76
77 xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
78
79 if [ "$HOSTOS" == "IRIX" ] ; then
80     mkfile 1M $TEST_DIR/6
81 else
82     xfs_mkfile 1M $TEST_DIR/6
83 fi
84
85 #try cp to dir
86 cp $TEST_DIR/6 $dir/6
87 xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
88
89 #try mv to dir
90 mv $TEST_DIR/6 $dir/7
91
92 xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
93
94 # success, all done
95 status=0
96 exit