From: Jeff Moyer <jmoyer@redhat.com>
To: Ian Kent <raven@themaw.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
autofs mailing list <autofs@linux.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 3/7] autofs4 - fix pending checks
Date: Fri, 18 Jul 2008 10:51:04 -0400 [thread overview]
Message-ID: <x491w1rdz53.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20080718023708.12802.82980.stgit@raven.themaw.net> (Ian Kent's message of "Fri, 18 Jul 2008 10:37:10 +0800")
Ian Kent <raven@themaw.net> writes:
> There are two cases for which a dentry that has a pending mount request
> does not wait for completion. One is via autofs4_revalidate() and the
> other via autofs4_follow_link().
>
> In revalidate, after the mount point directory is created, but before
> the mount is done, the check in try_to_fill_dentry() can can fail to
> send the dentry to the wait queue since the dentry is positive and the
> lookup flags may contain only LOOKUP_FOLLOW. Although we don't trigger
> a mount for the LOOKUP_FOLLOW flag, if ther's one pending we might as
> well wait and use the mounted dentry for the lookup.
>
> In autofs4_follow_link() the dentry is not checked to see if it is
> pending so it may fail to call try_to_fill_dentry() and not wait
> for mount completion.
>
> A dentry that is pending must always be sent to the wait queue.
>
> Signed-off-by: Ian Kent <raven@themaw.net>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
>
> ---
>
> fs/autofs4/root.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
>
> diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
> index e842b0a..2944b28 100644
> --- a/fs/autofs4/root.c
> +++ b/fs/autofs4/root.c
> @@ -177,7 +177,8 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
> return status;
> }
> /* Trigger mount for path component or follow link */
> - } else if (flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) ||
> + } else if (dentry->d_flags & DCACHE_AUTOFS_PENDING ||
> + flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) ||
> current->link_count) {
> DPRINTK("waiting for mount name=%.*s",
> dentry->d_name.len, dentry->d_name.name);
> @@ -223,7 +224,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
>
> /* If it's our master or we shouldn't trigger a mount we're done */
> lookup_type = nd->flags & (TRIGGER_FLAGS | TRIGGER_INTENTS);
> - if (oz_mode || !lookup_type)
> + if (oz_mode ||
> + !(lookup_type || dentry->d_flags & DCACHE_AUTOFS_PENDING))
> goto done;
>
> /* If an expire request is pending wait for it. */
> @@ -242,7 +244,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
> * don't try to mount it again.
> */
> spin_lock(&dcache_lock);
> - if (!d_mountpoint(dentry) && __simple_empty(dentry)) {
> + if (dentry->d_flags & DCACHE_AUTOFS_PENDING ||
> + (!d_mountpoint(dentry) && __simple_empty(dentry))) {
> spin_unlock(&dcache_lock);
>
> status = try_to_fill_dentry(dentry, 0);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2008-07-18 14:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-18 2:36 [PATCH 1/7] autofs4 - indirect dentry must almost always be positive Ian Kent
2008-07-18 2:37 ` [PATCH 2/7] autofs4 - cleanup redundant readir code Ian Kent
2008-07-18 14:47 ` Jeff Moyer
2008-07-18 15:26 ` Ian Kent
2008-07-18 2:37 ` [PATCH 3/7] autofs4 - fix pending checks Ian Kent
2008-07-18 14:51 ` Jeff Moyer [this message]
2008-07-18 2:37 ` [PATCH 4/7] autofs4 - fix indirect mount pending expire race Ian Kent
2008-07-18 18:52 ` Jeff Moyer
2008-07-18 18:56 ` Ian Kent
2008-07-18 19:14 ` Jeff Moyer
2008-07-18 2:37 ` [PATCH 5/7] autofs4 - fix direct " Ian Kent
2008-07-18 20:08 ` Jeff Moyer
2008-07-19 2:09 ` Ian Kent
2008-07-19 7:21 ` Ian Kent
2008-07-18 2:37 ` [PATCH 6/7] autofs4 - reorganize expire pending wait function calls Ian Kent
2008-07-18 2:37 ` [PATCH 7/7] autofs4 - remove unused ioctls Ian Kent
2008-07-18 20:09 ` Jeff Moyer
2008-07-18 11:56 ` [PATCH 1/7] autofs4 - indirect dentry must almost always be positive Jeff Moyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=x491w1rdz53.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=autofs@linux.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=raven@themaw.net \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).