aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2017-11-29 19:11:26 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-29 21:40:43 -0500
commit5d38f049cee1e1c4a7ac55aa79d37d01ddcc3860 (patch)
tree7ecfe3b2075538a5e882d2471f23eeb6adfc8e2b
parent43694d4bf843ddd34519e8e9de983deefeada699 (diff)
autofs: revert "autofs: fix AT_NO_AUTOMOUNT not being honored"
Commit 42f461482178 ("autofs: fix AT_NO_AUTOMOUNT not being honored") allowed the fstatat(2) system call to properly honor the AT_NO_AUTOMOUNT flag but introduced a semantic change. In order to honor AT_NO_AUTOMOUNT a semantic change was made to the negative dentry case for stat family system calls in follow_automount(). This changed the unconditional triggering of an automount in this case to no longer be done and an error returned instead. This has caused more problems than I expected so reverting the change is needed. In a discussion with Neil Brown it was concluded that the automount(8) daemon can implement this change without kernel modifications. So that will be done instead and the autofs module documentation updated with a description of the problem and what needs to be done by module users for this specific case. Link: http://lkml.kernel.org/r/151174730120.6162.3848002191530283984.stgit@pluto.themaw.net Fixes: 42f4614821 ("autofs: fix AT_NO_AUTOMOUNT not being honored") Signed-off-by: Ian Kent <raven@themaw.net> Cc: Neil Brown <neilb@suse.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: David Howells <dhowells@redhat.com> Cc: Colin Walters <walters@redhat.com> Cc: Ondrej Holy <oholy@redhat.com> Cc: <stable@vger.kernel.org> [4.11+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/namei.c15
-rw-r--r--include/linux/fs.h3
2 files changed, 5 insertions, 13 deletions
diff --git a/fs/namei.c b/fs/namei.c
index f0c7a7b9b6ca..9cc91fb7f156 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1129,18 +1129,9 @@ static int follow_automount(struct path *path, struct nameidata *nd,
1129 * of the daemon to instantiate them before they can be used. 1129 * of the daemon to instantiate them before they can be used.
1130 */ 1130 */
1131 if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | 1131 if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
1132 LOOKUP_OPEN | LOOKUP_CREATE | 1132 LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
1133 LOOKUP_AUTOMOUNT))) { 1133 path->dentry->d_inode)
1134 /* Positive dentry that isn't meant to trigger an 1134 return -EISDIR;
1135 * automount, EISDIR will allow it to be used,
1136 * otherwise there's no mount here "now" so return
1137 * ENOENT.
1138 */
1139 if (path->dentry->d_inode)
1140 return -EISDIR;
1141 else
1142 return -ENOENT;
1143 }
1144 1135
1145 if (path->dentry->d_sb->s_user_ns != &init_user_ns) 1136 if (path->dentry->d_sb->s_user_ns != &init_user_ns)
1146 return -EACCES; 1137 return -EACCES;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9dc498d16cc1..511fbaabf624 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3088,7 +3088,8 @@ static inline int vfs_lstat(const char __user *name, struct kstat *stat)
3088static inline int vfs_fstatat(int dfd, const char __user *filename, 3088static inline int vfs_fstatat(int dfd, const char __user *filename,
3089 struct kstat *stat, int flags) 3089 struct kstat *stat, int flags)
3090{ 3090{
3091 return vfs_statx(dfd, filename, flags, stat, STATX_BASIC_STATS); 3091 return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
3092 stat, STATX_BASIC_STATS);
3092} 3093}
3093static inline int vfs_fstat(int fd, struct kstat *stat) 3094static inline int vfs_fstat(int fd, struct kstat *stat)
3094{ 3095{