diff options
author | David Howells <dhowells@redhat.com> | 2011-01-14 13:45:31 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-15 20:07:33 -0500 |
commit | 6f45b65672c8017d5e210e338bb5858a938ef445 (patch) | |
tree | b62877c489fb682033c37d30d91c53e4d0c3833a /fs | |
parent | cc53ce53c86924bfe98a12ea20b7465038a08792 (diff) |
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')
-rw-r--r-- | fs/namei.c | 6 | ||||
-rw-r--r-- | fs/stat.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c index 9d3033dc22e9..dc50bfb2f5d6 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -908,6 +908,12 @@ static int follow_automount(struct path *path, unsigned flags, | |||
908 | if (!path->dentry->d_op || !path->dentry->d_op->d_automount) | 908 | if (!path->dentry->d_op || !path->dentry->d_op->d_automount) |
909 | return -EREMOTE; | 909 | return -EREMOTE; |
910 | 910 | ||
911 | /* We don't want to mount if someone supplied AT_NO_AUTOMOUNT | ||
912 | * and this is the terminal part of the path. | ||
913 | */ | ||
914 | if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_CONTINUE)) | ||
915 | return -EISDIR; /* we actually want to stop here */ | ||
916 | |||
911 | /* We want to mount if someone is trying to open/create a file of any | 917 | /* We want to mount if someone is trying to open/create a file of any |
912 | * type under the mountpoint, wants to traverse through the mountpoint | 918 | * type under the mountpoint, wants to traverse through the mountpoint |
913 | * or wants to open the mounted directory. | 919 | * or wants to open the mounted directory. |
@@ -75,11 +75,13 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, | |||
75 | int error = -EINVAL; | 75 | int error = -EINVAL; |
76 | int lookup_flags = 0; | 76 | int lookup_flags = 0; |
77 | 77 | ||
78 | if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) | 78 | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0) |
79 | goto out; | 79 | goto out; |
80 | 80 | ||
81 | if (!(flag & AT_SYMLINK_NOFOLLOW)) | 81 | if (!(flag & AT_SYMLINK_NOFOLLOW)) |
82 | lookup_flags |= LOOKUP_FOLLOW; | 82 | lookup_flags |= LOOKUP_FOLLOW; |
83 | if (flag & AT_NO_AUTOMOUNT) | ||
84 | lookup_flags |= LOOKUP_NO_AUTOMOUNT; | ||
83 | 85 | ||
84 | error = user_path_at(dfd, filename, lookup_flags, &path); | 86 | error = user_path_at(dfd, filename, lookup_flags, &path); |
85 | if (error) | 87 | if (error) |