svn commit: r274236 - stable/10/sys/fs/autofs
Edward Tomasz Napierala
trasz at FreeBSD.org
Fri Nov 7 15:47:23 UTC 2014
Author: trasz
Date: Fri Nov 7 15:47:22 2014
New Revision: 274236
URL: https://svnweb.freebsd.org/changeset/base/274236
Log:
MFC r272512:
Make autofs use shared vnode locks.
Sponsored by: The FreeBSD Foundation
Modified:
stable/10/sys/fs/autofs/autofs.h
stable/10/sys/fs/autofs/autofs_vfsops.c
stable/10/sys/fs/autofs/autofs_vnops.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/fs/autofs/autofs.h
==============================================================================
--- stable/10/sys/fs/autofs/autofs.h Fri Nov 7 15:45:34 2014 (r274235)
+++ stable/10/sys/fs/autofs/autofs.h Fri Nov 7 15:47:22 2014 (r274236)
@@ -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: stable/10/sys/fs/autofs/autofs_vfsops.c
==============================================================================
--- stable/10/sys/fs/autofs/autofs_vfsops.c Fri Nov 7 15:45:34 2014 (r274235)
+++ stable/10/sys/fs/autofs/autofs_vfsops.c Fri Nov 7 15:47:22 2014 (r274236)
@@ -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: stable/10/sys/fs/autofs/autofs_vnops.c
==============================================================================
--- stable/10/sys/fs/autofs/autofs_vnops.c Fri Nov 7 15:45:34 2014 (r274235)
+++ stable/10/sys/fs/autofs/autofs_vnops.c Fri Nov 7 15:47:22 2014 (r274236)
@@ -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);
More information about the svn-src-stable
mailing list