diff options
author | pjd <pjd@FreeBSD.org> | 2008-09-06 17:24:07 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2008-09-06 17:24:07 +0000 |
commit | ff89335810d9c40f030f75f25a8848c2ce4273f1 (patch) | |
tree | baac2726839e4525a54f35f1c254c8b05d3ac1cd /sys/cddl | |
parent | 65828aa4c7f5c98c28dd5864555de7a10a0acb62 (diff) | |
download | FreeBSD-src-ff89335810d9c40f030f75f25a8848c2ce4273f1.zip FreeBSD-src-ff89335810d9c40f030f75f25a8848c2ce4273f1.tar.gz |
Lock vnode exclusively around insmntque().
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 9 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c | 8 |
2 files changed, 7 insertions, 10 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index b721a7a..bb02a27 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -1303,12 +1303,6 @@ top: } } out: - - if (error == 0) { - *vpp = ZTOV(zp); - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); - } - if (dl) zfs_dirent_unlock(dl); @@ -1588,8 +1582,6 @@ top: zfs_log_create(zilog, tx, TX_MKDIR, dzp, zp, dirname); dmu_tx_commit(tx); - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); - zfs_dirent_unlock(dl); ZFS_EXIT(zfsvfs); @@ -2773,7 +2765,6 @@ out: if (error == 0) { zfs_log_symlink(zilog, tx, TX_SYMLINK, dzp, zp, name, link); *vpp = ZTOV(zp); - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); } dmu_tx_commit(tx); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c index 11ec438..800bc53 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c @@ -117,6 +117,7 @@ zfs_znode_cache_constructor(void *buf, void *cdrarg, int kmflags) if (cdrarg != NULL) { error = getnewvnode("zfs", vfsp, &zfs_vnodeops, &vp); ASSERT(error == 0); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); zp->z_vnode = vp; vp->v_data = (caddr_t)zp; VN_LOCK_AREC(vp); @@ -535,8 +536,10 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, uint64_t *oid, dmu_tx_t *tx, cred_t *cr, *zpp = zp; } else { - if (ZTOV(zp) != NULL) + if (ZTOV(zp) != NULL) { ZTOV(zp)->v_count = 0; + VOP_UNLOCK(ZTOV(zp), 0); + } dmu_buf_rele(dbp, NULL); zfs_znode_free(zp); } @@ -598,6 +601,7 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp) &zp->z_vnode); ASSERT(err == 0); vp = ZTOV(zp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vp->v_data = (caddr_t)zp; VN_LOCK_AREC(vp); VN_LOCK_ASHARE(vp); @@ -608,6 +612,7 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp) err = insmntque(vp, zfsvfs->z_vfs); vp->v_vflag &= ~VV_FORCEINSMQ; KASSERT(err == 0, ("insmntque() failed: error %d", err)); + VOP_UNLOCK(vp, 0); } mutex_exit(&zp->z_lock); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); @@ -623,6 +628,7 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp) zfs_znode_dmu_init(zp); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); *zpp = zp; + VOP_UNLOCK(vp, 0); return (0); } |