diff options
author | jeff <jeff@FreeBSD.org> | 2005-03-31 05:21:17 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-03-31 05:21:17 +0000 |
commit | f13ee4b8f22cddc38cdb5c5b16cd6f8f3cf1a8dd (patch) | |
tree | e58e8398e8baebbe5bb816f6b65d15c5eada1e87 | |
parent | 27112458d3c50f602c330698adc64c6fdd225307 (diff) | |
download | FreeBSD-src-f13ee4b8f22cddc38cdb5c5b16cd6f8f3cf1a8dd.zip FreeBSD-src-f13ee4b8f22cddc38cdb5c5b16cd6f8f3cf1a8dd.tar.gz |
- Set LK_NOSHARE for snapshot locks. snapshots require exclusive only
access.
- Remove the hack from ffs_lock() to implement LK_NOSHARE in a ffs
specific way.
Sponsored by: Isilon Systems, Inc.
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 20 |
2 files changed, 2 insertions, 22 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 70ba429..6b85472 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -522,7 +522,7 @@ loop: sn = malloc(sizeof *sn, M_UFSMNT, M_WAITOK | M_ZERO); TAILQ_INIT(&sn->sn_head); lockinit(&sn->sn_lock, PVFS, "snaplk", VLKTIMEOUT, - LK_CANRECURSE); + LK_CANRECURSE | LK_NOSHARE); VI_LOCK(vp); vp->v_vnlock = &sn->sn_lock; devvp->v_rdev->si_snapdata = sn; @@ -1846,7 +1846,7 @@ ffs_snapshot_mount(mp) sn = malloc(sizeof *sn, M_UFSMNT, M_WAITOK | M_ZERO); TAILQ_INIT(&sn->sn_head); lockinit(&sn->sn_lock, PVFS, "snaplk", VLKTIMEOUT, - LK_CANRECURSE); + LK_CANRECURSE | LK_NOSHARE); VI_LOCK(vp); vp->v_vnlock = &sn->sn_lock; devvp->v_rdev->si_snapdata = sn; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 0362876..13b6272 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -330,9 +330,6 @@ loop: return (ffs_update(vp, wait)); } -/* - * Snapshots require all lock requests to be exclusive. - */ static int ffs_lock(ap) struct vop_lock_args /* { @@ -341,23 +338,6 @@ ffs_lock(ap) struct thread *a_td; } */ *ap; { - struct vnode *vp = ap->a_vp; - - /* - * v_data could be NULL if a thread attempts to lock a - * vnode that is being recycled. Just hit the normal - * vnode lock in this case. Grab the interlock so we may - * safely inspect the vnode. - */ - if ((ap->a_flags & LK_INTERLOCK) == 0) { - VI_LOCK(vp); - ap->a_flags |= LK_INTERLOCK; - } - if (vp->v_data && (VTOI(vp)->i_flags & SF_SNAPSHOT) && - ((ap->a_flags & LK_TYPE_MASK) == LK_SHARED)) { - ap->a_flags &= ~LK_TYPE_MASK; - ap->a_flags |= LK_EXCLUSIVE; - } return (VOP_LOCK_APV(&ufs_vnodeops, ap)); } |