Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Nov 2005 18:47:11 GMT
From:      Mark Tinguely <tinguely@casselton.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/89247: QUOTA in 6.0/7.0-current leak
Message-ID:  <200511181847.jAIIlBF4086162@www.freebsd.org>
Resent-Message-ID: <200511181850.jAIIoQDO062713@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 18 18:50:25 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Mark Tinguely
>Release:        FreeBSD -6.0 and 7-current
>Organization:
>Environment:
FreeBSD markie 6.0-RELEASE FreeBSD 6.0-RELEASE #2: Fri Nov 18 12:12:33 CST 2005    tinguely@markie:/usr/src/sys/i386/compile/markie  i386
>Description:
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.
>How-To-Repeat:
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
>Fix:
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
        UFS_UNLOCK(ump);
        /*
***************
*** 193,199 ****
        (void) chkdq(ip, -btodb(size), cred, FORCE);
        UFS_LOCK(ump);
  #endif
- nospace:
        if (fs->fs_pendingblocks > 0 && reclaimed == 0) {
                reclaimed = 1;
                softdep_request_cleanup(fs, ITOV(ip));
--- 194,199 ----

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511181847.jAIIlBF4086162>