From owner-cvs-sys Fri Sep 19 04:18:36 1997 Return-Path: <owner-cvs-sys> Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id EAA04452 for cvs-sys-outgoing; Fri, 19 Sep 1997 04:18:36 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [195.8.129.26]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id EAA04447; Fri, 19 Sep 1997 04:18:29 -0700 (PDT) Received: from critter.freebsd.dk (localhost.cybercity.dk [127.0.0.1]) by critter.freebsd.dk (8.8.7/8.8.7) with ESMTP id NAA13317; Fri, 19 Sep 1997 13:17:40 +0200 (CEST) To: Bruce Evans <bde@zeta.org.au> cc: cvs-all@freebsd.org, cvs-committers@freebsd.org, cvs-sys@freebsd.org Subject: Re: cvs commit: src/sys/ufs/ffs ffs_alloc.c In-reply-to: Your message of "Fri, 19 Sep 1997 20:57:49 +1000." <199709191057.UAA12942@godzilla.zeta.org.au> Date: Fri, 19 Sep 1997 13:17:40 +0200 Message-ID: <13315.874667860@critter.freebsd.dk> From: Poul-Henning Kamp <phk@critter.freebsd.dk> Sender: owner-cvs-sys@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Thanks for the correction. I've committed your change. Poul-Henning In message <199709191057.UAA12942@godzilla.zeta.org.au>, Bruce Evans writes: >>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 <wosch@apfel.de> > >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) { -- Poul-Henning Kamp FreeBSD coreteam member phk@FreeBSD.ORG "Real hackers run -current on their laptop."