Page MenuHomeFreeBSD

D57857.id180658.diff
No OneTemporary

D57857.id180658.diff

diff --git a/sys/fs/autofs/autofs_vnops.c b/sys/fs/autofs/autofs_vnops.c
--- a/sys/fs/autofs/autofs_vnops.c
+++ b/sys/fs/autofs/autofs_vnops.c
@@ -572,16 +572,7 @@
anp->an_name = strdup(name, M_AUTOFS);
anp->an_fileno = atomic_fetchadd_int(&amp->am_last_fileno, 1);
callout_init(&anp->an_callout, 1);
- /*
- * The reason for SX_NOWITNESS here is that witness(4)
- * cannot tell vnodes apart, so the following perfectly
- * valid lock order...
- *
- * vnode lock A -> autofsvlk B -> vnode lock B
- *
- * ... gets reported as a LOR.
- */
- sx_init_flags(&anp->an_vnode_lock, "autofsvlk", SX_NOWITNESS);
+ sx_init(&anp->an_vnode_lock, "autofsvlk");
getnanotime(&anp->an_ctime);
anp->an_parent = parent;
anp->an_mount = amp;
@@ -645,6 +636,7 @@
{
struct vnode *vp;
int error;
+ enum vgetstate vs;
AUTOFS_ASSERT_UNLOCKED(anp->an_mount);
@@ -652,31 +644,26 @@
vp = anp->an_vnode;
if (vp != NULL) {
- error = vget(vp, flags | LK_RETRY);
- if (error != 0) {
- AUTOFS_WARN("vget failed with error %d", error);
- sx_xunlock(&anp->an_vnode_lock);
- return (error);
- }
+ vs = vget_prep(vp);
+ sx_xunlock(&anp->an_vnode_lock);
+ vget_finish(vp, flags | LK_RETRY, vs);
if (VN_IS_DOOMED(vp)) {
/*
* We got forcibly unmounted.
*/
AUTOFS_DEBUG("doomed vnode");
- sx_xunlock(&anp->an_vnode_lock);
vput(vp);
return (ENOENT);
}
*vpp = vp;
- sx_xunlock(&anp->an_vnode_lock);
return (0);
}
+ sx_xunlock(&anp->an_vnode_lock);
error = getnewvnode("autofs", mp, &autofs_vnodeops, &vp);
if (error != 0) {
- sx_xunlock(&anp->an_vnode_lock);
return (error);
}
@@ -692,13 +679,12 @@
error = insmntque(vp, mp);
if (error != 0) {
AUTOFS_DEBUG("insmntque() failed with error %d", error);
- sx_xunlock(&anp->an_vnode_lock);
return (error);
}
+ sx_xlock(&anp->an_vnode_lock);
KASSERT(anp->an_vnode == NULL, ("lost race"));
anp->an_vnode = vp;
-
sx_xunlock(&anp->an_vnode_lock);
vn_set_state(vp, VSTATE_CONSTRUCTED);

File Metadata

Mime Type
text/plain
Expires
Sat, Jun 27, 1:39 AM (5 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34373406
Default Alt Text
D57857.id180658.diff (1 KB)

Event Timeline