* [PATCH] VFS: Fix automount for negative autofs dentries
@ 2011-07-11 13:20 David Howells
2011-07-11 13:41 ` Christoph Hellwig
2011-07-11 14:13 ` David Howells
0 siblings, 2 replies; 4+ messages in thread
From: David Howells @ 2011-07-11 13:20 UTC (permalink / raw)
To: viro; +Cc: autofs, linux-fsdevel, linux-kernel, David Howells, Ian Kent
Autofs may set the DCACHE_NEED_AUTOMOUNT flag on negative dentries. These
need attention from the automounter daemon regardless of the LOOKUP_FOLLOW flag.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ian Kent <raven@themaw.net>
---
fs/namei.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 0223c41..93e221e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -777,18 +777,29 @@ static int follow_automount(struct path *path, unsigned flags,
if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_CONTINUE))
return -EISDIR; /* we actually want to stop here */
- /* We want to mount if someone is trying to open/create a file of any
- * type under the mountpoint, wants to traverse through the mountpoint
- * or wants to open the mounted directory.
- *
- * We don't want to mount if someone's just doing a stat and they've
+ /* We don't want to mount if someone's just doing a stat and they've
* set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and
* appended a '/' to the name.
*/
- if (!(flags & LOOKUP_FOLLOW) &&
- !(flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
- LOOKUP_OPEN | LOOKUP_CREATE)))
+ if (!(flags & LOOKUP_FOLLOW)) {
+ /* We do, however, want to mount if someone wants to open or
+ * create a file of any type under the mountpoint, wants to
+ * traverse through the mountpoint or wants to open the mounted
+ * directory.
+ */
+ if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
+ LOOKUP_OPEN | LOOKUP_CREATE))
+ goto need_automount;
+
+ /* Also, autofs may mark negative dentries as being automount
+ * points. These will need the attentions of the daemon to
+ * instantiate them before they can be used.
+ */
+ if (!path->dentry->d_inode)
+ goto need_automount;
return -EISDIR;
+ }
+need_automount:
current->total_link_count++;
if (current->total_link_count >= 40)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] VFS: Fix automount for negative autofs dentries
2011-07-11 13:20 [PATCH] VFS: Fix automount for negative autofs dentries David Howells
@ 2011-07-11 13:41 ` Christoph Hellwig
2011-07-11 14:13 ` David Howells
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2011-07-11 13:41 UTC (permalink / raw)
To: David Howells; +Cc: viro, autofs, linux-fsdevel, linux-kernel, Ian Kent
> + if (!(flags & LOOKUP_FOLLOW)) {
> + /* We do, however, want to mount if someone wants to open or
> + * create a file of any type under the mountpoint, wants to
> + * traverse through the mountpoint or wants to open the mounted
> + * directory.
> + */
> + if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
> + LOOKUP_OPEN | LOOKUP_CREATE))
> + goto need_automount;
> +
> + /* Also, autofs may mark negative dentries as being automount
> + * points. These will need the attentions of the daemon to
> + * instantiate them before they can be used.
> + */
> + if (!path->dentry->d_inode)
> + goto need_automount;
> return -EISDIR;
> + }
> +need_automount:
That's some really odd code structure.
if (!(flags & (LOOKUP_FOLLOW | LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
LOOKUP_OPEN | LOOKUP_CREATE)) &&
path->dentry->d_inode)
return -EISDIR;
would do the same.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] VFS: Fix automount for negative autofs dentries
2011-07-11 13:20 [PATCH] VFS: Fix automount for negative autofs dentries David Howells
2011-07-11 13:41 ` Christoph Hellwig
@ 2011-07-11 14:13 ` David Howells
2011-07-11 15:24 ` Christoph Hellwig
1 sibling, 1 reply; 4+ messages in thread
From: David Howells @ 2011-07-11 14:13 UTC (permalink / raw)
To: Christoph Hellwig
Cc: dhowells, viro, autofs, linux-fsdevel, linux-kernel, Ian Kent
Christoph Hellwig <hch@infradead.org> wrote:
> would do the same.
But is much less obvious. The LOOKUP_FOLLOW flag is the primary reason for
this statement. The rest are subordinate and would be wholly irrelevant if
LOOKUP_FOLLOW was to be removed from the list.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] VFS: Fix automount for negative autofs dentries
2011-07-11 14:13 ` David Howells
@ 2011-07-11 15:24 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2011-07-11 15:24 UTC (permalink / raw)
To: David Howells
Cc: Christoph Hellwig, viro, autofs, linux-fsdevel, linux-kernel,
Ian Kent
On Mon, Jul 11, 2011 at 03:13:41PM +0100, David Howells wrote:
> Christoph Hellwig <hch@infradead.org> wrote:
>
> > would do the same.
>
> But is much less obvious. The LOOKUP_FOLLOW flag is the primary reason for
> this statement. The rest are subordinate and would be wholly irrelevant if
> LOOKUP_FOLLOW was to be removed from the list.
Then keep the LOOKUP_FOLLOW semi-separate as in the original code.
But there's absolutely no reason for the goto spaghetti.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-11 15:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-11 13:20 [PATCH] VFS: Fix automount for negative autofs dentries David Howells
2011-07-11 13:41 ` Christoph Hellwig
2011-07-11 14:13 ` David Howells
2011-07-11 15:24 ` Christoph Hellwig
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).