Article View: net.bugs.4bsd
Article #1726Bug in /etc/quotacheck
From: Gunnar Lindberg
Date: Tue, 04 Nov 1986 16:39
Date: Tue, 04 Nov 1986 16:39
80 lines
3262 bytes
3262 bytes
/etc/quotacheck does not correct quota file entries for users that
no longer owns any files in the file system.
System:
UNIX BSD 4.2++ (TURBO), VAX 11/780.
Mainly used for education so we quite frequently create and
remove users (which may be part of the problem).
Observation:
/etc/repquota starts reporting numerous "#1234..." entries. Using
"find -user 1234", however, does not give anything. In fact, the
quota file is in error since the user's entry should have been
cleared out but hasn't.
Repeat by:
God knows! I have no idea on how to reproduce the situation.
There could be bugs in the way the kernel manipulates the quota
files when root removes files (is this likely?). At times we remove
quite large amounts of users (200-300) using shell scripts, possibly
this could lead to "quota overrun"...
Fix:
What /etc/quotacheck mainly does, is going through the file system
(inode tables) collecting file sizes etc. for each user. These
values are the compared to the content of the quota file for the
users that were found during the search. However, no check is made
that the users *not* found in the search has zero entries in the
quota file! Diff's, see below.
Gunnar Lindberg (lindberg@chalmers.{UUCP,CSNET})
Department of Computer Science
Chalmers University of Technology
S-412 96 Gothenburg, SWEDEN
RCS file: quotacheck.c,v
retrieving revision 1.1
diff -r1.1 quotacheck.c
56a57
> struct fileusage zerofupbuf; /* Empty entry */
163,166c164
< for (uid = 0; uid <= highuid; uid++) {
< fup = lookup(uid);
< if (fup == 0)
< continue;
---
> for (uid = 0, i = 1; ; uid++) {
170,175c168,190
< dqbuf = zerodqbuf;
< if (dqbuf.dqb_curinodes == fup->fu_usage.du_curinodes &&
< dqbuf.dqb_curblocks == fup->fu_usage.du_curblocks) {
< fup->fu_usage.du_curinodes = 0;
< fup->fu_usage.du_curblocks = 0;
< continue;
---
> dqbuf = zerodqbuf; /* Unknown... */
> if (i == 0 && uid > highuid) /* EOF && End of users */
> break;
> fup = lookup(uid);
> if (fup == (struct fileusage *)0)
> {
> /*
> * If we didn't find him in our inode-search he (hopefully)
> * doesn't own any files here. If quota file says different
> * we'd better fix it!
> */
> if (dqbuf.dqb_curinodes == 0 && dqbuf.dqb_curblocks == 0)
> continue; /* Empty, OK */
> fup = &zerofupbuf; /* clear it out */
> }
> else
> {
> if (dqbuf.dqb_curinodes == fup->fu_usage.du_curinodes &&
> dqbuf.dqb_curblocks == fup->fu_usage.du_curblocks) {
> fup->fu_usage.du_curinodes = 0;
> fup->fu_usage.du_curblocks = 0;
> continue;
> }
Technical Details
Message-ID:
<862@chalmers.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!mcvax!enea!chalmers!lindbergShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!mcvax!enea!chalmers!lindberg From: lindberg@chalmers.UUCP (Gunnar Lindberg) Newsgroups: net.bugs.4bsd Subject: Bug in /etc/quotacheck Message-ID: <862@chalmers.UUCP> Date: Tue, 4-Nov-86 11:39:19 EST Article-I.D.: chalmers.862 Posted: Tue Nov 4 11:39:19 1986 Date-Received: Fri, 7-Nov-86 21:59:19 EST Organization: Dept. of CS, Chalmers, Sweden Lines: 80