svn commit: r248626 - stable/9/sys/ufs/ffs

Kirk McKusick mckusick at FreeBSD.org
Fri Mar 22 22:40:17 UTC 2013


Author: mckusick
Date: Fri Mar 22 22:40:16 2013
New Revision: 248626
URL: http://svnweb.freebsd.org/changeset/base/248626

Log:
  MFS of 246289:
  
  For UFS2 i_blocks is unsigned. The current "sanity" check that it
  has gone below zero after the blocks in its inode are freed is a
  no-op which the compiler fails to warn about because of the use of
  the DIP macro. Change the sanity check to compare the number of
  blocks being freed against the value i_blocks. If the number of
  blocks being freed exceeds i_blocks, just set i_blocks to zero.
  
  Reported by: Pedro Giffuni (pfg@)

Modified:
  stable/9/sys/ufs/ffs/ffs_inode.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/dev/puc/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)
  stable/9/sys/net/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/ufs/ffs/ffs_inode.c
==============================================================================
--- stable/9/sys/ufs/ffs/ffs_inode.c	Fri Mar 22 21:50:43 2013	(r248625)
+++ stable/9/sys/ufs/ffs/ffs_inode.c	Fri Mar 22 22:40:16 2013	(r248626)
@@ -547,9 +547,9 @@ done:
 	 */
 	ip->i_size = length;
 	DIP_SET(ip, i_size, length);
-	DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased);
-
-	if (DIP(ip, i_blocks) < 0)			/* sanity */
+	if (DIP(ip, i_blocks) >= blocksreleased)
+		DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased);
+	else	/* sanity */
 		DIP_SET(ip, i_blocks, 0);
 	ip->i_flag |= IN_CHANGE;
 #ifdef QUOTA


More information about the svn-src-stable-9 mailing list