summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorbp <bp@FreeBSD.org>2001-01-31 04:54:23 +0000
committerbp <bp@FreeBSD.org>2001-01-31 04:54:23 +0000
commit85976e83491a410e25a72d8dc20f376938d46c5d (patch)
tree24289cc9e3d6b1aeae89b034354d46db26432a34 /sys/kern
parent076c2e70fda136ef48c7da93fc16bf7d4c7cb0cf (diff)
downloadFreeBSD-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.c13
-rw-r--r--sys/kern/vfs_subr.c13
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);
OpenPOWER on IntegriCloud