From owner-svn-src-stable@FreeBSD.ORG Sun May 29 18:09:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 058B6106564A; Sun, 29 May 2011 18:09:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9ABD8FC18; Sun, 29 May 2011 18:09:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TI9ED9040719; Sun, 29 May 2011 18:09:14 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TI9ESQ040717; Sun, 29 May 2011 18:09:14 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201105291809.p4TI9ESQ040717@svn.freebsd.org> From: Kirk McKusick Date: Sun, 29 May 2011 18:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222455 - stable/8/sys/ufs/ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:09:15 -0000 Author: mckusick Date: Sun May 29 18:09:14 2011 New Revision: 222455 URL: http://svn.freebsd.org/changeset/base/222455 Log: MFC r222334: The check for whether a block is going to be claimed by a snapshot needs to happen before we notify the underlying layer that it is being freed. Modified: stable/8/sys/ufs/ffs/ffs_alloc.c Modified: stable/8/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_alloc.c Sun May 29 18:00:50 2011 (r222454) +++ stable/8/sys/ufs/ffs/ffs_alloc.c Sun May 29 18:09:14 2011 (r222455) @@ -1874,10 +1874,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size /* devvp is a normal disk device */ dev = devvp->v_rdev; cgblkno = fsbtodb(fs, cgtod(fs, cg)); - ASSERT_VOP_LOCKED(devvp, "ffs_blkfree"); - if ((devvp->v_vflag & VV_COPYONWRITE) && - ffs_snapblkfree(fs, devvp, bno, size, inum)) - return; + ASSERT_VOP_LOCKED(devvp, "ffs_blkfree_cg"); } #ifdef INVARIANTS if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || @@ -2024,6 +2021,17 @@ ffs_blkfree(ump, fs, devvp, bno, size, i struct bio *bip; struct ffs_blkfree_trim_params *tp; + /* + * Check to see if a snapshot wants to claim the block. + * Check that devvp is a normal disk device, not a snapshot, + * it has a snapshot(s) associated with it, and one of the + * snapshots wants to claim the block. + */ + if (devvp->v_type != VREG && + (devvp->v_vflag & VV_COPYONWRITE) && + ffs_snapblkfree(fs, devvp, bno, size, inum)) { + return; + } if (!ump->um_candelete) { ffs_blkfree_cg(ump, fs, devvp, bno, size, inum); return;