Commit 5d38f049 authored by Ian Kent's avatar Ian Kent Committed by Linus Torvalds

autofs: revert "autofs: fix AT_NO_AUTOMOUNT not being honored"

Commit 42f46148 ("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

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.

Fixes: 42f46148 ("autofs: fix AT_NO_AUTOMOUNT not being honored")
Signed-off-by: default avatarIan Kent <>
Cc: Neil Brown <>
Cc: Al Viro <>
Cc: David Howells <>
Cc: Colin Walters <>
Cc: Ondrej Holy <>
Cc: <>	[4.11+]
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 43694d4b
......@@ -1129,18 +1129,9 @@ static int follow_automount(struct path *path, struct nameidata *nd,
* of the daemon to instantiate them before they can be used.
/* Positive dentry that isn't meant to trigger an
* automount, EISDIR will allow it to be used,
* otherwise there's no mount here "now" so return
if (path->dentry->d_inode)
return -EISDIR;
return -ENOENT;
return -EISDIR;
if (path->dentry->d_sb->s_user_ns != &init_user_ns)
return -EACCES;
......@@ -3088,7 +3088,8 @@ static inline int vfs_lstat(const char __user *name, struct kstat *stat)
static inline int vfs_fstatat(int dfd, const char __user *filename,
struct kstat *stat, int flags)
return vfs_statx(dfd, filename, flags, stat, STATX_BASIC_STATS);
return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
static inline int vfs_fstat(int fd, struct kstat *stat)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment