linux-stable/fs/autofs4
Ian Kent 6d5cb926fa autofs4: use lookup intent flags to trigger mounts
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.

[akpm@linux-foundation.org: fix build for concurrent VFS changes]
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:31 -07:00
..
autofs_i.h autofs4: use look aside list for lookups 2008-07-24 10:47:31 -07:00
expire.c autofs: path_{get,put}() cleanups 2008-05-01 08:04:01 -07:00
init.c [PATCH] AUTOFS: Make sure all dentries refs are released before calling kill_anon_super() 2006-10-11 11:14:25 -07:00
inode.c autofs4: use look aside list for lookups 2008-07-24 10:47:31 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
root.c autofs4: use lookup intent flags to trigger mounts 2008-07-24 10:47:31 -07:00
symlink.c [PATCH] mark struct inode_operations const 1 2007-02-12 09:48:46 -08:00
waitq.c autofs4: check for invalid dentry in getpath 2008-05-01 08:04:01 -07:00