Page MenuHomeFreeBSD

autofs: enable witness for autofs node lock
Needs ReviewPublic

Authored by rew on Thu, Jun 25, 10:57 PM.

Details

Reviewers
kib
Summary

Previously, an_vnode_lock was initialized with SX_NOWITNESS to silence
lock order reversals. The reversals would occur when autofs_node_vn()
was called with the directory vnode lock held, then lock an_vnode_lock,
then lock the vnode attached to the autofs node. It looked like:

directory vnode -> an_vnode_lock -> vnode attached to autofs node

The established lock order is now vnode -> an_vnode_lock

Currently, we don't have to worry about losing an autofs node during the
unlock/lock as autofs nodes are only removed during an unmount() after
vflush(). When autofs_node_vn() is called, the mountpoint has either
been busied (preventing unmount) or a directory vnode is locked which
prevents vflush() from finishing until the directory vnode is unlocked.

If all this looks like its going in the right direction, my next change
will be to hold am_lock (the lock the protects the autofs node tree),
across autofs_node_vn() - which will be step torwards getting autofs
ready to handle autofs node removals

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74271
Build 71154: arc lint + arc unit

Event Timeline

rew requested review of this revision.Thu, Jun 25, 10:57 PM
rew added a reviewer: kib.
sys/fs/autofs/autofs_vnops.c
687

What prevents two threads from observing vp == NULL and then allocate both a new an_vnode?