summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2011-01-14 18:45:31 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2011-01-15 20:07:33 -0500
commit6f45b65672c8017d5e210e338bb5858a938ef445 (patch)
treeb62877c489fb682033c37d30d91c53e4d0c3833a /fs/namei.c
parentcc53ce53c86924bfe98a12ea20b7465038a08792 (diff)
downloadop-kernel-dev-6f45b65672c8017d5e210e338bb5858a938ef445.zip
op-kernel-dev-6f45b65672c8017d5e210e338bb5858a938ef445.tar.gz
Add an AT_NO_AUTOMOUNT flag to suppress terminal automount
Add an AT_NO_AUTOMOUNT flag to suppress terminal automounting of automount point directories. This can be used by fstatat() users to permit the gathering of attributes on an automount point and also prevent mass-automounting of a directory of automount points by ls. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Ian Kent <raven@themaw.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 9d3033d..dc50bfb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -908,6 +908,12 @@ static int follow_automount(struct path *path, unsigned flags,
if (!path->dentry->d_op || !path->dentry->d_op->d_automount)
return -EREMOTE;
+ /* We don't want to mount if someone supplied AT_NO_AUTOMOUNT
+ * and this is the terminal part of the path.
+ */
+ 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.
OpenPOWER on IntegriCloud