From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 18 18:50:27 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9ABC816A41F for ; Fri, 18 Nov 2005 18:50:27 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 567C543D4C for ; Fri, 18 Nov 2005 18:50:26 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jAIIoQs7062714 for ; Fri, 18 Nov 2005 18:50:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jAIIoQDO062713; Fri, 18 Nov 2005 18:50:26 GMT (envelope-from gnats) Resent-Date: Fri, 18 Nov 2005 18:50:26 GMT Resent-Message-Id: <200511181850.jAIIoQDO062713@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mark Tinguely Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8416116A41F for ; Fri, 18 Nov 2005 18:47:16 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 017A143D76 for ; Fri, 18 Nov 2005 18:47:11 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id jAIIlBNg086163 for ; Fri, 18 Nov 2005 18:47:11 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id jAIIlBF4086162; Fri, 18 Nov 2005 18:47:11 GMT (envelope-from nobody) Message-Id: <200511181847.jAIIlBF4086162@www.freebsd.org> Date: Fri, 18 Nov 2005 18:47:11 GMT From: Mark Tinguely To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: kern/89247: QUOTA in 6.0/7.0-current leak X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2005 18:50:27 -0000 >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: