From owner-cvs-sys Fri Sep 19 04:01:13 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id EAA03638 for cvs-sys-outgoing; Fri, 19 Sep 1997 04:01:13 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id EAA03626; Fri, 19 Sep 1997 04:01:04 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id UAA12942; Fri, 19 Sep 1997 20:57:49 +1000 Date: Fri, 19 Sep 1997 20:57:49 +1000 From: Bruce Evans Message-Id: <199709191057.UAA12942@godzilla.zeta.org.au> To: cvs-all@freebsd.org, cvs-committers@freebsd.org, cvs-sys@freebsd.org, phk@freebsd.org Subject: Re: cvs commit: src/sys/ufs/ffs ffs_alloc.c Sender: owner-cvs-sys@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >phk 1997/09/18 11:07:45 PDT > > Modified files: > sys/ufs/ffs ffs_alloc.c > Log: > Ffs_alloc allow users to write one block beyond the limit. > > PR: 3398 > Reviewed by: phk > Submitted by: Wolfram Schneider This is completely wrong. 1. ffs_alloc() actually allowed writing one block less one frag (normally 7 frags or 7/8 blocks) beyond the limit. 2. freebufspace() gives the free space in frags, but `size' is in bytes, so the change results in approximately `size' fragments too many being reserved. 3. ffs_realloccg() has the same bug but wasn't changed. Bruce Incompetely tested patches relative to the old version: diff -c2 ffs_alloc.c~ ffs_alloc.c *** ffs_alloc.c~ Wed Sep 3 11:16:21 1997 --- ffs_alloc.c Fri Sep 19 19:15:49 1997 *************** *** 118,122 **** if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0) goto nospace; ! if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0) goto nospace; #ifdef QUOTA --- 118,123 ---- if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0) goto nospace; ! if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) - ! numfrags(fs, size) < 0) goto nospace; #ifdef QUOTA *************** *** 188,192 **** panic("ffs_realloccg: missing credential"); #endif /* DIAGNOSTIC */ ! if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0) goto nospace; if ((bprev = ip->i_db[lbprev]) == 0) { --- 189,194 ---- panic("ffs_realloccg: missing credential"); #endif /* DIAGNOSTIC */ ! if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) - ! numfrags(fs, nsize - osize) < 0) goto nospace; if ((bprev = ip->i_db[lbprev]) == 0) {