aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2002-11-30 07:27:12 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2002-11-30 07:27:12 +0000
commit63cf5b0ee27112ba2d4ccd8e1d89df5ecb837217 (patch)
tree0841cd020a90f81787c8ef4ac67b2bee71d5a0d3
parenta963b34a5caeadaf659c2d2e3643f4f4a358bc2b (diff)
Notes
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 667b93785430..efa01df96fca 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -230,7 +230,7 @@ restart:
fs->fs_bsize, td->td_ucred, BA_METAONLY, &ibp);
if (error)
goto out;
- bdwrite(ibp);
+ bawrite(ibp);
}
/*
* Allocate copies for the superblock and its summary information.
@@ -257,7 +257,7 @@ restart:
fs->fs_bsize, KERNCRED, 0, &nbp);
if (error)
goto out;
- bdwrite(nbp);
+ bawrite(nbp);
}
/*
* Copy all the cylinder group maps. Although the
@@ -290,9 +290,12 @@ restart:
ip->i_flag |= IN_CHANGE | IN_UPDATE;
/*
* Ensure that the snapshot is completely on disk.
+ * Since we have marked it as a snapshot it is safe to
+ * unlock it as no process will be allowed to write to it.
*/
if ((error = VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td)) != 0)
goto out;
+ VOP_UNLOCK(vp, 0, td);
/*
* All allocations are done, so we can now snapshot the system.
*
@@ -309,12 +312,14 @@ restart:
vn_finished_write(wrtmp);
if ((error = vfs_write_suspend(vp->v_mount)) != 0) {
vn_start_write(NULL, &wrtmp, V_WAIT);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
goto out;
}
if (mp->mnt_kern_flag & MNTK_SUSPENDED)
break;
vn_start_write(NULL, &wrtmp, V_WAIT);
}
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (collectsnapstats)
nanotime(&starttime);
/*