Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 1997 13:17:40 +0200
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
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 
Message-ID:  <13315.874667860@critter.freebsd.dk>
In-Reply-To: Your message of "Fri, 19 Sep 1997 20:57:49 %2B1000." <199709191057.UAA12942@godzilla.zeta.org.au> 

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

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."



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