From: David Howells <dhowells@redhat.com>
To: Ian Kent <raven@themaw.net>
Cc: dhowells@redhat.com, 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: Mon, 26 Jul 2010 16:54:55 +0100 [thread overview]
Message-ID: <30118.1280159695@redhat.com> (raw)
In-Reply-To: <1280157768.3569.14.camel@localhost>
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.
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-26 15:54 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
[not found] ` <20100722175847.5552.11520.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-07-22 17:58 ` [PATCH 3/6] NFS: " David Howells
2010-07-22 17:59 ` [PATCH 4/6] CIFS: " 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
[not found] ` <17723.1279897759-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-24 4:11 ` Ian Kent
2010-07-26 14:19 ` David Howells
[not found] ` <9168.1280153997-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-26 15:22 ` Ian Kent
2010-07-26 15:54 ` David Howells [this message]
[not found] ` <30118.1280159695-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-27 3:43 ` Ian Kent
2010-07-27 8:48 ` David Howells
[not found] ` <12883.1280220521-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-27 12:51 ` Ian Kent
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
[not found] ` <20100722175913.5552.3905.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-07-22 18:01 ` David Howells
2010-07-23 15:11 ` [PATCH 6/6] Add an AT_NO_AUTOMOUNT flag to suppress terminal automount [ver #2] 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=30118.1280159695@redhat.com \
--to=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=raven@themaw.net \
--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).