kern/89247: QUOTA in 6.0/7.0-current leak

Mark Tinguely tinguely at
Fri Nov 18 18:50:27 GMT 2005

>Number:         89247
>Category:       kern
>Synopsis:       QUOTA in 6.0/7.0-current leak
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 18 18:50:25 GMT 2005
>Originator:     Mark Tinguely
>Release:        FreeBSD -6.0 and 7-current
FreeBSD markie 6.0-RELEASE FreeBSD 6.0-RELEASE #2: Fri Nov 18 12:12:33 CST 2005    tinguely at markie:/usr/src/sys/i386/compile/markie  i386
In FreeBSD 6.0 and 7.0 -current /sys/ufs/ffs/ffs_alloc.c ffs_alloc() QUOTA is set before checking if the allocation can be met. Either the quota check should be after checking if there is available disk space or when determining there is no space, the reserved quota should be removed. I like option 2 - see below patch.
1) fill a partition that has QUOTA enabled
2) quota -v
3) try to write a chunk of data (it will fail because the partition is full)
4) quota -v  and notice the quota keep increasing by the attempted chunk amount
5) delete all the data owned by this user in this partition
6) quota -v and notice the quota is still off by the attempted chunk amount

or visually look at code and see the chkdq() don't match
move the noswap: label above the chkdq() that readjusts the allocated quota:

*** ffs_alloc.c.orig    Fri Nov 18 12:37:38 2005
--- ffs_alloc.c Fri Nov 18 12:38:35 2005
*** 185,190 ****
--- 185,191 ----
                *bnp = bno;
                return (0);
+ nospace:
  #ifdef QUOTA
*** 193,199 ****
        (void) chkdq(ip, -btodb(size), cred, FORCE);
- nospace:
        if (fs->fs_pendingblocks > 0 && reclaimed == 0) {
                reclaimed = 1;
                softdep_request_cleanup(fs, ITOV(ip));
--- 194,199 ----


More information about the freebsd-bugs mailing list