xfs/299: users can't modify root owned files
authorDave Chinner <dchinner@redhat.com>
Tue, 18 Feb 2014 06:16:26 +0000 (17:16 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 18 Feb 2014 06:16:26 +0000 (17:16 +1100)
xfs/299 has failed for me for a long time. In fact, looking at my
logs it has never passed on any of my test machines. IOWs, the
test that was committed was fundamentally broken.

The reason is that it tests project quotas before it tests user or
group quotas and so creates a bunch of files that are owned by root
or privileged users. It think tries to manipulate them as a user,
and, unsurprisingly, it fails to do so. This then causes the test to
throw an error.

The reason it has always failed is the error that is thrown
hardcodes a uid/gid into an error message. This uid/gid is what
causes the golden output mismatch (nobody is 65534 on my machines,
not 99):

     *** push past the hard block limit (expect EDQUOT)
     [ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
     [NAME] =OK= 100 500 00 [--------] 7 4 10 00 [7 days] 0 0 0 00 [--------]
    - URK 99: 0 is out of range! [425,500]
    + URK 65534: 0 is out of range! [425,500]

It wasn't until I looked at the xfs/299.full file when trying to
understand why the error was being thrown and whether it shoul dhave
been in the golden output in the first place that I saw the real
problem. That is, All the user/group quota modifications were
failing because of not having permissions to write the files left
behind by the quota test, and that user and group quotas were not
being tested at all by the test.

So, firstly $SCRATCH_MNT needs to be world writeable, and secondly
each test needs to remove the files it created during the test so
they don't impact on furture test iterations.

This then exercises the user and group quotas appropriately, and so
the golden output changes completely to reflect that changes under
user quotas are actually being accounted to the correct user.
Further, the error message that I originally saw errors on goes
away, because everything is now accounted correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/xfs/299
tests/xfs/299.out

index e374131623bb57bc52155f11714d74bfa4ef088a..d1909743c2e480f24daf4d66e3a3596eaf0dc97a 100755 (executable)
@@ -193,6 +193,9 @@ _exercise()
 
        echo
 
+       # clean up our files so we don't pollute the next run
+       rm -f $SCRATCH_MNT/*
+
 }
 
 _scratch_mkfs_xfs -m crc=1 2>/dev/null | _filter_mkfs 2>$tmp.mkfs
@@ -200,6 +203,9 @@ cat $tmp.mkfs >>$seqres.full
 # keep the blocksize and data size for dd later
 . $tmp.mkfs
 
+# non-root users need to be able to write to this filesystem
+chmod 777 $SCRATCH_MNT
+
 cat >$tmp.projects <<EOF
 1:$SCRATCH_MNT
 EOF
index 4185c98bf7a4047117bd53f83b519889e57d54dc..d13c7da10e16defe622da584029ec695341cbc03 100644 (file)
@@ -32,59 +32,51 @@ realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
 
 
 *** report no quota settings
-[ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
 
 *** report initial settings
-[ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 1 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft inode limit
-[ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 3 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft block limit
-[ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [7 days] 4 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 7 4 10 00 [7 days] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 12 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] =OK= 100 500 00 [--------] 7 4 10 00 [7 days] 0 0 0 00 [--------]
- URK 99: 0 is out of range! [425,500]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] =OK= 100 500 00 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
 
 
 *** report no quota settings
-[ROOT] 0 0 0 00 [--------] 10 0 0 00 [--------] 0 0 0 00 [--------]
-#1 500 0 0 00 [--------] 9 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
 
 *** report initial settings
-[ROOT] 0 0 0 00 [--------] 10 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
-#1 500 0 0 00 [--------] 9 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 1 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft inode limit
-[ROOT] 0 0 0 00 [--------] 10 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
-#1 500 0 0 00 [--------] 9 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 3 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft block limit
-[ROOT] 0 0 0 00 [--------] 10 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
-#1 500 0 0 00 [--------] 9 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [7 days] 4 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 10 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
-#1 500 0 0 00 [--------] 9 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 10 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] =OK= 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
-#1 500 0 0 00 [--------] 9 0 0 00 [--------] 0 0 0 00 [--------]
- URK 99: 0 is out of range! [425,500]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] =OK= 100 500 00 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
 
 *** unmount
 meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
@@ -120,50 +112,50 @@ realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
 
 
 *** report no quota settings
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
 
 *** report initial settings
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 1 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft inode limit
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 3 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft block limit
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [--------] 4 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [--------] 16 4 10 00 [--none--] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 540 100 500 00 [--none--] 16 4 10 00 [--none--] 0 0 0 00 [--------]
 
 
 *** report no quota settings
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
 
 *** report initial settings
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 1 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft inode limit
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 3 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the soft block limit
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [--------] 4 4 10 00 [--------] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 140 100 500 00 [--------] 16 4 10 00 [--none--] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
-[ROOT] 0 0 0 00 [--------] 19 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 0 4 10 00 [--------] 0 0 0 00 [--------]
+[ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
+[NAME] 540 100 500 00 [--none--] 16 4 10 00 [--none--] 0 0 0 00 [--------]
 
 *** unmount