aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2011-05-26 23:56:58 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2011-05-26 23:56:58 +0000
commit99f6ac66ad540fa76459cfa2384fbb24886b8c5b (patch)
tree7699080792169e19a4d4c3f750497891d75400e3 /sys/ufs
parent66d972cfd61fde2c22319b3329b3473fafd2e2bb (diff)
downloadsrc-99f6ac66ad540fa76459cfa2384fbb24886b8c5b.tar.gz
src-99f6ac66ad540fa76459cfa2384fbb24886b8c5b.zip
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.
Notes
Notes: svn path=/head/; revision=222334
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index e60514d5db86..9b5425b5940a 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1873,10 +1873,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd)
/* 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 ||
@@ -2030,6 +2027,17 @@ ffs_blkfree(ump, fs, devvp, bno, size, inum, dephd)
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, dephd);
return;