From: Ian Kent <raven@themaw.net>
To: Jim Carter <jimc@math.ucla.edu>,
autofs mailing list <autofs@linux.kernel.org>
Subject: [PATCH 08/10] autofs4 - use lookup intent flags to trigger mounts
Date: Thu, 12 Jun 2008 12:51:25 +0800 [thread overview]
Message-ID: <20080612045125.25151.37880.stgit@raven.themaw.net> (raw)
In-Reply-To: <20080612044425.25151.58126.stgit@raven.themaw.net>
When an open(2) call is made on an autofs mount point directory that
already exists and the O_DIRECTORY flag is not used the needed mount
callback to the daemon is not done. This leads to the path walk
continuing resulting in a callback to the daemon with an incorrect
key. open(2) is called without O_DIRECTORY by the "find" utility but
this should be handled properly anyway.
This happens because autofs needs to use the lookup flags to decide
when to callback to the daemon to perform a mount to prevent mount
storms. For example, an autofs indirect mount map that has the "browse"
option will have the mount point directories are pre-created and the
stat(2) call made by a color ls against each directory will cause all
these directories to be mounted. It is unfortunate we need to resort
to this but mount maps can be quite large. Additionally, if a user
manually umounts an autofs indirect mount the directory isn't removed
which also leads to this situation.
To resolve this autofs needs to use the lookup intent flags to enable
it to make this decision. This patch adds this check and triggers a
call back if any of the lookup intent flags are set as all these calls
warrant a mount attempt be requested.
I know that external VFS code which uses the lookup flags is something
that the VFS would like to eliminate but I have no choice as I can't
see any other way to do this. A VFS dentry or inode operation callback
which returns the lookup "type" (requires a definition) would be
sufficient. But this change is needed now and I'm not aware of the form
that coming VFS changes will take so I'm not willing to propose anything
along these lines.
If anyone can provide an alternate method I would be happy to use it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
fs/autofs4/root.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 8a94717..2c878e5 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -31,6 +31,9 @@ static int autofs4_root_readdir(struct file * filp, void * dirent, filldir_t fil
static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
static void *autofs4_follow_link(struct dentry *, struct nameidata *);
+#define TRIGGER_FLAGS (LOOKUP_CONTINUE | LOOKUP_DIRECTORY)
+#define TRIGGER_INTENTS (LOOKUP_OPEN | LOOKUP_ACCESS | LOOKUP_CREATE)
+
const struct file_operations autofs4_root_operations = {
.open = dcache_dir_open,
.release = dcache_dir_close,
@@ -291,7 +294,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
return status;
}
/* Trigger mount for path component or follow link */
- } else if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY) ||
+ } else if (flags & (TRIGGER_FLAGS | TRIGGER_INTENTS) ||
current->link_count) {
DPRINTK("waiting for mount name=%.*s",
dentry->d_name.len, dentry->d_name.name);
@@ -335,7 +338,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
nd->flags);
/* If it's our master or we shouldn't trigger a mount we're done */
- lookup_type = nd->flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY);
+ lookup_type = nd->flags & (TRIGGER_FLAGS | TRIGGER_INTENTS);
if (oz_mode || !lookup_type)
goto done;
next prev parent reply other threads:[~2008-06-12 4:51 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-12 4:50 [PATCH 00/10] Kernel patch series Ian Kent
2008-06-12 4:50 ` [PATCH 01/10] autofs4 - check for invalid dentry in getpath Ian Kent
2008-06-12 4:50 ` [PATCH 02/10] autofs4 - fix sparse warning in waitq.c:autofs4_expire_indirect() Ian Kent
2008-06-12 4:50 ` [PATCH 03/10] autofs4 - fix incorrect return from root.c:try_to_fill_dentry() Ian Kent
2008-06-12 4:51 ` [PATCH 04/10] autofs4 - fix mntput, dput order bug Ian Kent
2008-06-12 4:51 ` [PATCH 05/10] autofs4 - don't make expiring dentry negative Ian Kent
2008-06-12 4:51 ` [PATCH 06/10] autofs4 - use look aside list for lookups Ian Kent
2008-06-12 4:51 ` [PATCH 07/10] autofs4 - don't release directory mutex if called in oz_mode Ian Kent
2008-06-12 4:51 ` Ian Kent [this message]
2008-06-12 4:51 ` [PATCH 09/10] autofs4 - use struct qstr in waitq.c Ian Kent
2008-06-12 4:51 ` [PATCH 10/10] autofs4 - fix pending mount race Ian Kent
2008-06-14 1:13 ` [PATCH 00/10] Kernel patch series Jim Carter
2008-06-14 3:30 ` Ian Kent
2008-06-14 3:42 ` Ian Kent
2008-06-19 0:40 ` clients suddenly start hanging (was: (no subject)) Jim Carter
2008-06-19 3:14 ` Ian Kent
2008-06-19 17:08 ` Jim Carter
2008-06-19 18:34 ` Jim Carter
2008-06-20 4:09 ` Ian Kent
2008-06-21 1:02 ` Jim Carter
2008-06-21 3:12 ` Ian Kent
2008-06-23 3:49 ` Jim Carter
2008-06-23 4:46 ` Ian Kent
2008-06-24 3:08 ` Ian Kent
2008-06-24 17:02 ` Stephen Biggs
2008-06-24 23:39 ` Jim Carter
2008-06-25 3:33 ` Ian Kent
2008-06-25 5:00 ` Ian Kent
2008-06-23 4:15 ` Ian Kent
-- strict thread matches above, loose matches on Subject: below --
2008-04-23 18:50 (no subject) Jim Carter
2008-04-23 20:04 ` Jeff Moyer
2008-04-24 3:10 ` Ian Kent
2008-04-24 16:52 ` clients suddenly start hanging (was: (no subject)) Jim Carter
2008-04-26 1:17 ` Jim Carter
2008-04-26 5:34 ` Ian Kent
2008-04-26 18:48 ` Jim Carter
2008-04-27 5:52 ` Ian Kent
2008-04-26 22:16 ` Jim Carter
2008-04-28 6:26 ` [PATCH 1/2] autofs4 - fix execution order race in mount request code Ian Kent
2008-05-08 4:52 ` clients suddenly start hanging (was: (no subject)) Jim Carter
2008-05-08 6:13 ` Ian Kent
2008-05-11 4:14 ` Jim Carter
2008-05-11 7:57 ` Ian Kent
2008-05-15 21:59 ` Jim Carter
2008-05-16 3:00 ` Ian Kent
2008-05-18 4:07 ` Ian Kent
2008-05-21 6:58 ` Ian Kent
2008-05-22 21:42 ` Jim Carter
2008-05-23 2:35 ` Ian Kent
2008-05-26 0:34 ` Jim Carter
2008-06-12 3:20 ` Ian Kent
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=20080612045125.25151.37880.stgit@raven.themaw.net \
--to=raven@themaw.net \
--cc=autofs@linux.kernel.org \
--cc=jimc@math.ucla.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.