Skip to content
Commit ff09297e authored by Al Viro's avatar Al Viro
Browse files

autofs: simplify get_next_positive_...(), get rid of trylocks



* new helper: positive_after(parent, child); parent->d_lock is
held by caller, grabs and returns the first thing after child
in the list of children that has simple_positive() true.  NULL
if nothing's found; NULL child == search the entire list.

* get_next_positive_subdir() loses the redundant check for
d_count and switches to use of that helper.  BTW, dput(NULL) is
a no-op for a good reason...

* get_next_positive_dentry() switched to the same helper.  Logics:
look for positive child in prev; if not found, look for the
positive child of prev's parent following prev, etc.  That way
we are guaranteed that we are only moving rootwards through the
ancestors of prev, which is pinned and thus not going anywhere.
Since ->d_parent on autofs never changes, the same goes for
the entire chain of ancestors and we don't need overlapping
->d_lock on them.  Which avoids the trylock loops, in addition
to simplifying the logics in there...

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5f9e832c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment