mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-24 10:44:53 +00:00
[Regarding the previous patch] 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. PR: 3398 Submitted by: bde Eyeballed by: phk
This commit is contained in:
parent
9ec1c55cfc
commit
ec1d10e413
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29609
|
@ -31,7 +31,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_alloc.c 8.18 (Berkeley) 5/26/95
|
||||
* $Id: ffs_alloc.c,v 1.35 1997/09/02 20:06:44 bde Exp $
|
||||
* $Id: ffs_alloc.c,v 1.36 1997/09/18 18:07:45 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
|
@ -117,7 +117,8 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp)
|
|||
#endif /* DIAGNOSTIC */
|
||||
if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0)
|
||||
goto nospace;
|
||||
if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) - size < 0)
|
||||
if (cred->cr_uid != 0 &&
|
||||
freespace(fs, fs->fs_minfree) - numfrags(fs, size) < 0)
|
||||
goto nospace;
|
||||
#ifdef QUOTA
|
||||
error = chkdq(ip, (long)btodb(size), cred, 0);
|
||||
|
@ -187,7 +188,8 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
|
|||
if (cred == NOCRED)
|
||||
panic("ffs_realloccg: missing credential");
|
||||
#endif /* DIAGNOSTIC */
|
||||
if (cred->cr_uid != 0 && freespace(fs, fs->fs_minfree) <= 0)
|
||||
if (cred->cr_uid != 0 &&
|
||||
freespace(fs, fs->fs_minfree) - numfrags(fs, nsize - osize) < 0)
|
||||
goto nospace;
|
||||
if ((bprev = ip->i_db[lbprev]) == 0) {
|
||||
printf("dev = 0x%lx, bsize = %ld, bprev = %ld, fs = %s\n",
|
||||
|
|
Loading…
Reference in a new issue