Date: Sat, 4 Oct 2014 09:37:41 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272512 - head/sys/fs/autofs Message-ID: <201410040937.s949bf0h041348@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sat Oct 4 09:37:40 2014 New Revision: 272512 URL: https://svnweb.freebsd.org/changeset/base/272512 Log: Make autofs use shared vnode locks. Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/autofs/autofs.h head/sys/fs/autofs/autofs_vfsops.c head/sys/fs/autofs/autofs_vnops.c Modified: head/sys/fs/autofs/autofs.h ============================================================================== --- head/sys/fs/autofs/autofs.h Sat Oct 4 08:55:08 2014 (r272511) +++ head/sys/fs/autofs/autofs.h Sat Oct 4 09:37:40 2014 (r272512) @@ -138,6 +138,6 @@ int autofs_node_find(struct autofs_node const char *name, int namelen, struct autofs_node **anpp); void autofs_node_delete(struct autofs_node *anp); int autofs_node_vn(struct autofs_node *anp, struct mount *mp, - struct vnode **vpp); + int flags, struct vnode **vpp); #endif /* !AUTOFS_H */ Modified: head/sys/fs/autofs/autofs_vfsops.c ============================================================================== --- head/sys/fs/autofs/autofs_vfsops.c Sat Oct 4 08:55:08 2014 (r272511) +++ head/sys/fs/autofs/autofs_vfsops.c Sat Oct 4 09:37:40 2014 (r272512) @@ -88,6 +88,10 @@ autofs_mount(struct mount *mp) vfs_getnewfsid(mp); + MNT_ILOCK(mp); + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; + MNT_IUNLOCK(mp); + AUTOFS_XLOCK(amp); error = autofs_node_new(NULL, amp, ".", -1, &->am_root); if (error != 0) { @@ -177,7 +181,7 @@ autofs_root(struct mount *mp, int flags, amp = VFSTOAUTOFS(mp); - error = autofs_node_vn(amp->am_root, mp, vpp); + error = autofs_node_vn(amp->am_root, mp, flags, vpp); return (error); } Modified: head/sys/fs/autofs/autofs_vnops.c ============================================================================== --- head/sys/fs/autofs/autofs_vnops.c Sat Oct 4 08:55:08 2014 (r272511) +++ head/sys/fs/autofs/autofs_vnops.c Sat Oct 4 09:37:40 2014 (r272512) @@ -198,12 +198,12 @@ mounted: } static int -autofs_vget_callback(struct mount *mp, void *arg, int lkflags __unused, +autofs_vget_callback(struct mount *mp, void *arg, int flags, struct vnode **vpp) { - return (autofs_node_vn(arg, mp, vpp)); + return (autofs_node_vn(arg, mp, flags, vpp)); } static int @@ -233,7 +233,7 @@ autofs_lookup(struct vop_lookup_args *ap * use vn_vget_ino_gen() which takes care of all that. */ error = vn_vget_ino_gen(dvp, autofs_vget_callback, - anp->an_parent, 0, vpp); + anp->an_parent, cnp->cn_lkflags, vpp); if (error != 0) { AUTOFS_WARN("vn_vget_ino_gen() failed with error %d", error); @@ -294,7 +294,7 @@ autofs_lookup(struct vop_lookup_args *ap */ AUTOFS_SUNLOCK(amp); - error = autofs_node_vn(child, mp, vpp); + error = autofs_node_vn(child, mp, cnp->cn_lkflags, vpp); if (error != 0) { if ((cnp->cn_flags & ISLASTCN) && cnp->cn_nameiop == CREATE) return (EJUSTRETURN); @@ -334,7 +334,7 @@ autofs_mkdir(struct vop_mkdir_args *ap) } AUTOFS_XUNLOCK(amp); - error = autofs_node_vn(child, vp->v_mount, ap->a_vpp); + error = autofs_node_vn(child, vp->v_mount, LK_EXCLUSIVE, ap->a_vpp); return (error); } @@ -581,7 +581,8 @@ autofs_node_delete(struct autofs_node *a } int -autofs_node_vn(struct autofs_node *anp, struct mount *mp, struct vnode **vpp) +autofs_node_vn(struct autofs_node *anp, struct mount *mp, int flags, + struct vnode **vpp) { struct vnode *vp; int error; @@ -592,7 +593,7 @@ autofs_node_vn(struct autofs_node *anp, vp = anp->an_vnode; if (vp != NULL) { - error = vget(vp, LK_EXCLUSIVE | LK_RETRY, curthread); + error = vget(vp, flags | LK_RETRY, curthread); if (error != 0) { AUTOFS_WARN("vget failed with error %d", error); sx_xunlock(&anp->an_vnode_lock); @@ -632,6 +633,8 @@ autofs_node_vn(struct autofs_node *anp, vp->v_vflag |= VV_ROOT; vp->v_data = anp; + VN_LOCK_ASHARE(vp); + error = insmntque(vp, mp); if (error != 0) { AUTOFS_WARN("insmntque() failed with error %d", error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410040937.s949bf0h041348>