Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs Revert previous commit. Locking the snapshot vn...
details: https://anonhg.NetBSD.org/src/rev/104da1b738a1
branches: trunk
changeset: 764843:104da1b738a1
user: hannken <hannken%NetBSD.org@localhost>
date: Sun May 08 18:37:15 2011 +0000
description:
Revert previous commit. Locking the snapshot vnode while the file system
is suspended extends the suspension until the vnode gets unlocked by
the caller of ffs_snapshot().
Resuming the file system before expunging all snapshots and syncing the
snapshot creates races and deadlocks with journaling file systems at least.
diffstat:
sys/ufs/ffs/ffs_snapshot.c | 40 +++++++++++++---------------------------
1 files changed, 13 insertions(+), 27 deletions(-)
diffs (76 lines):
diff -r 40b52ceca23c -r 104da1b738a1 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c Sun May 08 14:22:16 2011 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c Sun May 08 18:37:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_snapshot.c,v 1.114 2011/04/29 09:45:15 hannken Exp $ */
+/* $NetBSD: ffs_snapshot.c,v 1.115 2011/05/08 18:37:15 hannken Exp $ */
/*
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.114 2011/04/29 09:45:15 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.115 2011/05/08 18:37:15 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -177,7 +177,7 @@
return EOPNOTSUPP;
}
#else /* defined(FFS_NO_SNAPSHOT) */
- bool suspended = false, snapshot_locked = false;
+ bool suspended = false;
int error, redo = 0, snaploc;
void *sbbuf = NULL;
daddr_t *snaplist = NULL, snaplistsize = 0;
@@ -310,24 +310,6 @@
DIP_ASSIGN(ip, mtimensec, ts.tv_nsec);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
/*
- * Lock the snapshot and resume file system.
- */
- mutex_enter(&si->si_snaplock);
- mutex_enter(&si->si_lock);
- si->si_owner = curlwp;
- mutex_exit(&si->si_lock);
- snapshot_locked = true;
- KASSERT(suspended);
- vfs_resume(vp->v_mount);
- suspended = false;
-#ifdef DEBUG
- getmicrotime(&endtime);
- timersub(&endtime, &starttime, &endtime);
- printf("%s: suspended %lld.%03d sec, redo %d of %d\n",
- mp->mnt_stat.f_mntonname, (long long)endtime.tv_sec,
- endtime.tv_usec / 1000, redo, fs->fs_ncg);
-#endif
- /*
* Copy allocation information from all snapshots and then
* expunge them from our view.
*/
@@ -399,13 +381,17 @@
si->si_gen++;
mutex_exit(&si->si_lock);
- if (suspended)
+ if (suspended) {
+ VOP_UNLOCK(vp);
vfs_resume(vp->v_mount);
- if (snapshot_locked) {
- mutex_enter(&si->si_lock);
- si->si_owner = NULL;
- mutex_exit(&si->si_lock);
- mutex_exit(&si->si_snaplock);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+#ifdef DEBUG
+ getmicrotime(&endtime);
+ timersub(&endtime, &starttime, &endtime);
+ printf("%s: suspended %lld.%03d sec, redo %d of %d\n",
+ mp->mnt_stat.f_mntonname, (long long)endtime.tv_sec,
+ endtime.tv_usec / 1000, redo, fs->fs_ncg);
+#endif
}
if (error) {
if (!UFS_WAPBL_BEGIN(mp)) {
Home |
Main Index |
Thread Index |
Old Index