From owner-svn-src-all@FreeBSD.ORG Sun Feb 3 17:16:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0270387E; Sun, 3 Feb 2013 17:16:33 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD8D3198; Sun, 3 Feb 2013 17:16:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13HGXH4060304; Sun, 3 Feb 2013 17:16:33 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13HGXNP060303; Sun, 3 Feb 2013 17:16:33 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201302031716.r13HGXNP060303@svn.freebsd.org> From: Kirk McKusick Date: Sun, 3 Feb 2013 17:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246289 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 17:16:34 -0000 Author: mckusick Date: Sun Feb 3 17:16:32 2013 New Revision: 246289 URL: http://svnweb.freebsd.org/changeset/base/246289 Log: 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@) MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_inode.c Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 15:54:57 2013 (r246288) +++ head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 17:16:32 2013 (r246289) @@ -546,9 +546,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