From: Ian Kent <raven@themaw.net>
To: David Howells <dhowells@redhat.com>
Cc: viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] Add a dentry op to handle automounting rather than abusing follow_link() [ver #2]
Date: Tue, 27 Jul 2010 11:43:45 +0800 [thread overview]
Message-ID: <1280202225.2944.20.camel@localhost> (raw)
In-Reply-To: <30118.1280159695@redhat.com>
On Mon, 2010-07-26 at 16:54 +0100, David Howells wrote:
> Ian Kent <raven@themaw.net> wrote:
>
> > > Does it make autofs easier if d_op->d_automount() is allowed to return
> > > -EXDEV to request this? Then you can return it in Oz mode to allow the
> > > daemon to see/use the underlying mountpoint without recursing back into
> > > d_automount().
> >
> > Yes, it's really useful.
>
> I think what's required, then, is if d_automount() returns -EXDEV then:
>
> (1) If the dentry is terminal in the lookup path, then we just return -EXDEV
> to indicate to __follow_mount() that we really do want to stop there.
>
> (2) If the dentry is not terminal, then we convert the error to -EREMOTE to
> indicate that we can't complete the pathwalk as one of the earlier
> components is inaccessible.
Is this something others need?
Again, the exists vs not yet exists case for paths within indirect
autofs mounts. At the moment I can just set the flag on all dentrys in
the autofs fs and return EXDEV for non-empty directories in order to
return the dentry as a path component. OTOH if the dentry is a mount
embeded in the path and the mount fails we get a error return.
I could clear the flag on non-root parent dentrys during mkdir if this
is needed by others.
>
> See the attached patch.
>
> David
> ---
> diff --git a/fs/namei.c b/fs/namei.c
> index c154112..6c385d4 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -653,8 +653,20 @@ static int follow_automount(struct path *path, unsigned flags, int res)
> return -ELOOP;
>
> mnt = path->dentry->d_op->d_automount(path);
> - if (IS_ERR(mnt))
> + if (IS_ERR(mnt)) {
> + /*
> + * The filesystem is allowed to return -EXDEV here to indicate
> + * they don't want to automount. For instance, autofs would do
> + * this so that its userspace daemon can mount on this dentry.
> + *
> + * However, we can only permit this if it's a terminal point in
> + * the path being looked up; if it wasn't then the remainder of
> + * the path is inaccessible and we should say so.
> + */
> + if (PTR_ERR(mnt) == -EXDEV && (flags & LOOKUP_CONTINUE))
> + return -EREMOTE;
> return PTR_ERR(mnt);
> + }
> if (!mnt) /* mount collision */
> return 0;
>
>
next prev parent reply other threads:[~2010-07-27 3:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-22 17:58 [PATCH 1/6] Add a dentry op to handle automounting rather than abusing follow_link() David Howells
2010-07-22 17:58 ` [PATCH 2/6] AFS: Use d_automount() " David Howells
2010-07-22 17:58 ` [PATCH 3/6] NFS: " David Howells
2010-07-22 17:59 ` [PATCH 4/6] CIFS: " David Howells
2010-07-22 17:59 ` [PATCH 5/6] Remove the automount through follow_link() kludge code from pathwalk David Howells
2010-07-22 17:59 ` [PATCH 6/6] Add an AT_NO_AUTOMOUNT flag to suppress terminal automount David Howells
2010-07-22 18:01 ` David Howells
2010-07-23 15:09 ` [PATCH 1/6] Add a dentry op to handle automounting rather than abusing follow_link() [ver #2] David Howells
2010-07-24 4:11 ` Ian Kent
2010-07-26 14:19 ` David Howells
2010-07-26 15:22 ` Ian Kent
2010-07-26 15:54 ` David Howells
2010-07-27 3:43 ` Ian Kent [this message]
2010-07-27 8:48 ` David Howells
2010-07-27 12:51 ` Ian Kent
[not found] ` <20100722175913.5552.3905.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-07-23 15:11 ` [PATCH 6/6] Add an AT_NO_AUTOMOUNT flag to suppress terminal automount " David Howells
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=1280202225.2944.20.camel@localhost \
--to=raven@themaw.net \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.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).