quota bug (?)

Scott Jennings (smj@oro.net)
16 Dec 1996 06:58:45 GMT


I've got a quota problem in 2.0.17 affecting roughly every 40th UID.

These ID's quotas show exactly twice the appropriate number of
consumed blocks, when copied or chowned. This means a user can
create a 10MB file, and show 20MB of quota consumed. Conversely,
he can delete a 10MB file, and reduce his quota consumtion by
20MB.

quotacheck corrects the problem for existing files.

This affects *roughly* every 40th UID, and exact UID's effected
are not constant accross filesystems, but are quite constant
within filesystems, even with different kernels.

A script was written to document the problem, it chowns a 13MB
file to each UID, recording the UID's quota consumtion both
before and after, and noting those that change by something other
than 13MB.

Note that the UID's affected are all divisible by 4, and
separated from each other by one of only three or four values.

Here is the script, followed by a sample output.

Any clues?

-----------------------------------------------------------------------------
#! /bin/bash
#

TUID=0
LAST=$TUID
FILESYSTEM=md1
JUNKFILE=junk.delete
JUNKSIZE=12889
LOGFILE=quota.oops

while [ $TUID -lt 60000 ]
do
Q1=`quota -v $TUID | grep $FILESYSTEM \
| sed -e s/'^.*$FILESYSTEM *'// -e s/' .*$'// | tr -d '*'`
chown $TUID:$TUID $JUNKFILE
Q2=`quota -v $TUID | grep $FILESYSTEM \
| sed -e s/'^.*$FILESYSTEM *'// -e s/' .*$'// | tr -d '*'`

let QD=$Q2-$Q1

echo -ne "$TUID:(`grep "\*:$TUID:" /etc/passwd | sed s/':.*$'//`) $Q2 - $Q1 = $QD \|\r"
if [ "$QD" != "$JUNKSIZE" ]
then
let DIFF=$TUID-$LAST
LAST=$TUID
echo -ne " \r"
echo "$TUID:(`grep "\*:$TUID:" /etc/passwd | sed s/':.*$'//`) [$DIFF] $Q2 - $Q1 = $QD"
echo "$TUID:(`grep "\*:$TUID:" /etc/passwd | sed s/':.*$'//`) [$DIFF] $Q2 - $Q1 = $QD" >>$LOGFILE
fi
let TUID=$TUID+1
done
-------------------------------------------------------------------------------
19: [19] 25778 - 0 = 25778
60: [41] 25778 - 0 = 25778
105: [45] 25778 - 0 = 25778
146: [41] 25778 - 0 = 25778
191: [45] 25778 - 0 = 25778
232: [41] 25778 - 0 = 25778
273: [41] 25778 - 0 = 25778
314: [41] 25778 - 0 = 25778
359: [45] 25778 - 0 = 25778
400: [41] 25778 - 0 = 25778
445: [45] 25778 - 0 = 25778
486: [41] 25778 - 0 = 25778
535: [49] 26785 - 1007 = 25778
576: [41] 25778 - 0 = 25778
621: [45] 26241 - 463 = 25778
662: [41] 27598 - 1820 = 25778
707: [45] 25778 - 0 = 25778
748: [41] 25785 - 7 = 25778
789: [41] 25799 - 21 = 25778
830: [41] 25785 - 7 = 25778
875: [45] 25786 - 8 = 25778
916: [41] 25785 - 7 = 25778
961: [45] 59668 - 33890 = 25778
1002: [41] 30146 - 4368 = 25778
1051: [49] 25785 - 7 = 25778
1092: [41] 25807 - 29 = 25778
1137: [45] 25785 - 7 = 25778
1178: [41] 25785 - 7 = 25778
1223: [45] 25785 - 7 = 25778
1264: [41] 25785 - 7 = 25778
1305: [41] 25785 - 7 = 25778
1346: [41] 25785 - 7 = 25778
1391: [45] 25786 - 8 = 25778
1432: [41] 25786 - 8 = 25778
1477: [45] 25785 - 7 = 25778
1518: [41] 25788 - 10 = 25778
1567: [49] 73690 - 47912 = 25778
1608: [41] 25784 - 6 = 25778
1653: [45] 25784 - 6 = 25778
1694: [41] 25792 - 14 = 25778
1739: [45] 27897 - 2119 = 25778
1780: [41] 25784 - 6 = 25778
1821: [41] 25784 - 6 = 25778
1862: [41] 25785 - 7 = 25778
1907: [45] 25785 - 7 = 25778
1948: [41] 25785 - 7 = 25778
1993: [45] 403813 - 378035 = 25778
2034: [41] 25924 - 146 = 25778
2051: [17] 25785 - 7 = 25778
2092: [41] 25784 - 6 = 25778
2137: [45] 25785 - 7 = 25778
2178: [41] 25785 - 7 = 25778
2223: [45] 25785 - 7 = 25778
2264: [41] 25786 - 8 = 25778
2305: [41] 25786 - 8 = 25778
2346: [41] 25784 - 6 = 25778
2391: [45] 25785 - 7 = 25778
2432: [41] 25785 - 7 = 25778
2477: [45] 25785 - 7 = 25778
2518: [41] 25785 - 7 = 25778
2567: [49] 25785 - 7 = 25778
2608: [41] 25778 - 0 = 25778
2653: [45] 25778 - 0 = 25778
2694: [41] 25778 - 0 = 25778
2739: [45] 25778 - 0 = 25778
2780: [41] 25778 - 0 = 25778
2821: [41] 25778 - 0 = 25778
2862: [41] 25778 - 0 = 25778
2907: [45] 25778 - 0 = 25778
2948: [41] 25778 - 0 = 25778
2993: [45] 26022 - 244 = 25778
3034: [41] 25778 - 0 = 25778
3083: [49] 25778 - 0 = 25778
3124: [41] 25778 - 0 = 25778
3169: [45] 25778 - 0 = 25778
3210: [41] 25778 - 0 = 25778
3255: [45] 25778 - 0 = 25778
3296: [41] 25778 - 0 = 25778
3337: [41] 25778 - 0 = 25778
3378: [41] 25778 - 0 = 25778
3423: [45] 25778 - 0 = 25778
3464: [41] 25778 - 0 = 25778
3509: [45] 25778 - 0 = 25778
3550: [41] 25778 - 0 = 25778
3599: [49] 25778 - 0 = 25778
3640: [41] 25778 - 0 = 25778
3685: [45] 25778 - 0 = 25778
3726: [41] 25778 - 0 = 25778
3771: [45] 25778 - 0 = 25778
3812: [41] 25778 - 0 = 25778
3853: [41] 25778 - 0 = 25778
3894: [41] 25778 - 0 = 25778
3939: [45] 25778 - 0 = 25778
3980: [41] 25778 - 0 = 25778
4025: [45] 25778 - 0 = 25778
4066: [41] 25778 - 0 = 25778
4102: [36] 25778 - 0 = 25778
4147: [45] 25778 - 0 = 25778
4188: [41] 25778 - 0 = 25778
4233: [45] 25778 - 0 = 25778
4274: [41] 25778 - 0 = 25778