diff options
author | bp <bp@FreeBSD.org> | 2001-01-31 04:54:23 +0000 |
---|---|---|
committer | bp <bp@FreeBSD.org> | 2001-01-31 04:54:23 +0000 |
commit | 85976e83491a410e25a72d8dc20f376938d46c5d (patch) | |
tree | 24289cc9e3d6b1aeae89b034354d46db26432a34 /sys/kern | |
parent | 076c2e70fda136ef48c7da93fc16bf7d4c7cb0cf (diff) | |
download | FreeBSD-src-85976e83491a410e25a72d8dc20f376938d46c5d.zip FreeBSD-src-85976e83491a410e25a72d8dc20f376938d46c5d.tar.gz |
Properly lock new vnode.
Reminded by: tegge
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_export.c | 13 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 13 |
2 files changed, 18 insertions, 8 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 6e2afda..3d76f7a 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -1380,12 +1380,17 @@ addaliasu(nvp, nvp_rdev) ovp->v_data = nvp->v_data; ovp->v_tag = nvp->v_tag; nvp->v_data = NULL; - ops = nvp->v_op; - nvp->v_op = ovp->v_op; - ovp->v_op = ops; - lockinit(&ovp->v_lock, PVFS, "vnlock", 0, LK_NOPAUSE); + lockinit(&ovp->v_lock, PVFS, nvp->v_lock.lk_wmesg, + nvp->v_lock.lk_timo, nvp->v_lock.lk_flags & LK_EXTFLG_MASK); if (nvp->v_vnlock) ovp->v_vnlock = &ovp->v_lock; + ops = ovp->v_op; + ovp->v_op = nvp->v_op; + if (VOP_ISLOCKED(nvp, curproc)) { + VOP_UNLOCK(nvp, 0, curproc); + vn_lock(ovp, LK_EXCLUSIVE | LK_RETRY, curproc); + } + nvp->v_op = ops; insmntque(ovp, nvp->v_mount); vrele(nvp); vgone(nvp); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 6e2afda..3d76f7a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1380,12 +1380,17 @@ addaliasu(nvp, nvp_rdev) ovp->v_data = nvp->v_data; ovp->v_tag = nvp->v_tag; nvp->v_data = NULL; - ops = nvp->v_op; - nvp->v_op = ovp->v_op; - ovp->v_op = ops; - lockinit(&ovp->v_lock, PVFS, "vnlock", 0, LK_NOPAUSE); + lockinit(&ovp->v_lock, PVFS, nvp->v_lock.lk_wmesg, + nvp->v_lock.lk_timo, nvp->v_lock.lk_flags & LK_EXTFLG_MASK); if (nvp->v_vnlock) ovp->v_vnlock = &ovp->v_lock; + ops = ovp->v_op; + ovp->v_op = nvp->v_op; + if (VOP_ISLOCKED(nvp, curproc)) { + VOP_UNLOCK(nvp, 0, curproc); + vn_lock(ovp, LK_EXCLUSIVE | LK_RETRY, curproc); + } + nvp->v_op = ops; insmntque(ovp, nvp->v_mount); vrele(nvp); vgone(nvp); |