@@ -271,3 +271,4 @@ static inline void autofs4_del_expiring(struct dentry *dentry)
}
void autofs4_kill_sb(struct super_block *);
+int is_autofs_finder(void);
@@ -200,6 +200,13 @@ static int autofs_dev_ioctl_protosubver(struct file *fp,
return 0;
}
+static DEFINE_MUTEX(autofs_find);
+static struct task_struct *autofs_finder = NULL;
+int is_autofs_finder(void)
+{
+ return autofs_finder == current;
+}
+
/* Find the topmost mount satisfying test() */
static int find_autofs_mount(const char *pathname,
struct path *res,
@@ -209,7 +216,12 @@ static int find_autofs_mount(const char *pathname,
struct path path;
int err;
- err = kern_path_mountpoint(AT_FDCWD, pathname, &path, 0);
+ mutex_lock(&autofs_find);
+ autofs_finder = current;
+ err = kern_path(pathname, 0, &path);
+ autofs_finder = NULL;
+ mutex_unlock(&autofs_find);
+
if (err)
return err;
err = -ENOENT;
@@ -438,7 +438,7 @@ static int autofs4_d_manage(const struct path *path, bool rcu_walk)
pr_debug("dentry=%p %pd\n", dentry, dentry);
/* The daemon never waits. */
- if (autofs4_oz_mode(sbi)) {
+ if (autofs4_oz_mode(sbi) || is_autofs_finder()) {
if (!path_is_mountpoint(path))
return -EISDIR;
return 0;