From f2807820032fe586ea72f9048accb23a9d17c75f Mon Sep 17 00:00:00 2001 From: truckman Date: Thu, 19 Sep 2002 13:32:45 +0000 Subject: VOP_FSYNC() requires that it's vnode argument be locked, which nfs_link() wasn't doing. Rather than just lock and unlock the vnode around the call to VOP_FSYNC(), implement rwatson's suggestion to lock the file vnode in kern_link() before calling VOP_LINK(), since the other filesystems also locked the file vnode right away in their link methods. Remove the locking and and unlocking from the leaf filesystem link methods. Reviewed by: rwatson, bde (except for the unionfs_link() changes) --- sys/gnu/ext2fs/ext2_vnops.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'sys/gnu/ext2fs') diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index dd24a9d..c1fba78 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -827,7 +827,6 @@ ext2_link(ap) struct vnode *vp = ap->a_vp; struct vnode *tdvp = ap->a_tdvp; struct componentname *cnp = ap->a_cnp; - struct thread *td = cnp->cn_thread; struct inode *ip; int error; @@ -837,19 +836,16 @@ ext2_link(ap) #endif if (tdvp->v_mount != vp->v_mount) { error = EXDEV; - goto out2; - } - if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, td))) { - goto out2; + goto out; } ip = VTOI(vp); if ((nlink_t)ip->i_nlink >= LINK_MAX) { error = EMLINK; - goto out1; + goto out; } if (ip->i_flags & (IMMUTABLE | APPEND)) { error = EPERM; - goto out1; + goto out; } ip->i_nlink++; ip->i_flag |= IN_CHANGE; @@ -860,10 +856,7 @@ ext2_link(ap) ip->i_nlink--; ip->i_flag |= IN_CHANGE; } -out1: - if (tdvp != vp) - VOP_UNLOCK(vp, 0, td); -out2: +out: return (error); } -- cgit v1.1