Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 1997 20:57:49 +1000
From:      Bruce Evans <bde@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
Message-ID:  <199709191057.UAA12942@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>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) {



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