From owner-freebsd-bugs Tue Apr 3 11:50: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 013A837B724 for ; Tue, 3 Apr 2001 11:50:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f33Io1519320; Tue, 3 Apr 2001 11:50:01 -0700 (PDT) (envelope-from gnats) Received: from bg.sics.se (bg.sics.se [193.10.66.124]) by hub.freebsd.org (Postfix) with ESMTP id 7800237B71D for ; Tue, 3 Apr 2001 11:46:48 -0700 (PDT) (envelope-from bg@bg.sics.se) Received: (from bg@localhost) by bg.sics.se (8.11.1/8.11.1) id f33IknH19740; Tue, 3 Apr 2001 20:46:49 +0200 (CEST) (envelope-from bg) Message-Id: <200104031846.f33IknH19740@bg.sics.se> Date: Tue, 3 Apr 2001 20:46:49 +0200 (CEST) From: bg@sics.se Reply-To: bg@sics.se To: FreeBSD-gnats-submit@freebsd.org Cc: bg@sics.se X-Send-Pr-Version: 3.2 Subject: misc/26323: Quota subsystem generates zero-length files Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26323 >Category: misc >Synopsis: Quota system create zero-length files >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Apr 03 11:50:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Bjoern Groenvall >Release: FreeBSD 4.2-RELEASE i386 >Organization: SICS >Environment: Systems using the UFS quota subsystem. >Description: When a user comes close to his block quota limit, there are often many zero-length files created. This can be avoided be requiring a minimum number of blocks before inode creation is allowed to prooeed. >How-To-Repeat: >Fix: Enable the following code using sysctl. --- ufs_quota.c 2000/11/18 11:49:53 1.1 +++ ufs_quota.c 2000/11/19 09:22:03 1.2 @@ -46,12 +46,17 @@ #include #include #include +#include + #include #include #include #include +static int quota_minblocks = 0; +SYSCTL_INT(_debug, OID_AUTO, quota_minblocks , CTLFLAG_RW, "a_minblocks, 0, ""); + static MALLOC_DEFINE(M_DQUOT, "UFS quota", "UFS quota entries"); /* @@ -275,6 +280,15 @@ error = chkiqchg(ip, change, cred, i); if (error) return (error); + /* + * If user has fewer than quota_minblocks + * left, disallow inode allocation. + */ + if (quota_minblocks > 0) { + error = chkdqchg(ip, quota_minblocks, cred, i); + if (error) + return (error); + } } } for (i = 0; i < MAXQUOTAS; i++) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message