Commit dd36a882 authored by Ian Kent's avatar Ian Kent Committed by Al Viro

autofs: change autofs4_wait() to take struct path

In order to use the functions path_is_mountpoint() and path_has_submounts()
autofs needs to pass a struct path in several places.

Now change autofs4_wait() to take a struct path instead of a struct
dentry.

Link: http://lkml.kernel.org/r/20161011053413.27645.84666.stgit@pluto.themaw.netSigned-off-by: default avatarIan Kent <raven@themaw.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Omar Sandoval <osandov@osandov.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 74f504cf
...@@ -217,7 +217,8 @@ static inline int autofs_prepare_pipe(struct file *pipe) ...@@ -217,7 +217,8 @@ static inline int autofs_prepare_pipe(struct file *pipe)
/* Queue management functions */ /* Queue management functions */
int autofs4_wait(struct autofs_sb_info *, struct dentry *, enum autofs_notify); int autofs4_wait(struct autofs_sb_info *,
const struct path *, enum autofs_notify);
int autofs4_wait_release(struct autofs_sb_info *, autofs_wqt_t, int); int autofs4_wait_release(struct autofs_sb_info *, autofs_wqt_t, int);
void autofs4_catatonic_mode(struct autofs_sb_info *); void autofs4_catatonic_mode(struct autofs_sb_info *);
......
...@@ -526,7 +526,7 @@ int autofs4_expire_wait(const struct path *path, int rcu_walk) ...@@ -526,7 +526,7 @@ int autofs4_expire_wait(const struct path *path, int rcu_walk)
pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); pr_debug("waiting for expire %p name=%pd\n", dentry, dentry);
status = autofs4_wait(sbi, dentry, NFY_NONE); status = autofs4_wait(sbi, path, NFY_NONE);
wait_for_completion(&ino->expire_complete); wait_for_completion(&ino->expire_complete);
pr_debug("expire done status=%d\n", status); pr_debug("expire done status=%d\n", status);
...@@ -593,11 +593,12 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, ...@@ -593,11 +593,12 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt,
if (dentry) { if (dentry) {
struct autofs_info *ino = autofs4_dentry_ino(dentry); struct autofs_info *ino = autofs4_dentry_ino(dentry);
struct path path = { .mnt = mnt, .dentry = dentry };
/* This is synchronous because it makes the daemon a /* This is synchronous because it makes the daemon a
* little easier * little easier
*/ */
ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); ret = autofs4_wait(sbi, &path, NFY_EXPIRE);
spin_lock(&sbi->fs_lock); spin_lock(&sbi->fs_lock);
/* avoid rapid-fire expire attempts if expiry fails */ /* avoid rapid-fire expire attempts if expiry fails */
......
...@@ -269,17 +269,17 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry, ...@@ -269,17 +269,17 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry,
return NULL; return NULL;
} }
static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk) static int autofs4_mount_wait(const struct path *path, bool rcu_walk)
{ {
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); struct autofs_sb_info *sbi = autofs4_sbi(path->dentry->d_sb);
struct autofs_info *ino = autofs4_dentry_ino(dentry); struct autofs_info *ino = autofs4_dentry_ino(path->dentry);
int status = 0; int status = 0;
if (ino->flags & AUTOFS_INF_PENDING) { if (ino->flags & AUTOFS_INF_PENDING) {
if (rcu_walk) if (rcu_walk)
return -ECHILD; return -ECHILD;
pr_debug("waiting for mount name=%pd\n", dentry); pr_debug("waiting for mount name=%pd\n", path->dentry);
status = autofs4_wait(sbi, dentry, NFY_MOUNT); status = autofs4_wait(sbi, path, NFY_MOUNT);
pr_debug("mount wait done status=%d\n", status); pr_debug("mount wait done status=%d\n", status);
} }
ino->last_used = jiffies; ino->last_used = jiffies;
...@@ -364,7 +364,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) ...@@ -364,7 +364,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
spin_lock(&sbi->fs_lock); spin_lock(&sbi->fs_lock);
if (ino->flags & AUTOFS_INF_PENDING) { if (ino->flags & AUTOFS_INF_PENDING) {
spin_unlock(&sbi->fs_lock); spin_unlock(&sbi->fs_lock);
status = autofs4_mount_wait(dentry, 0); status = autofs4_mount_wait(path, 0);
if (status) if (status)
return ERR_PTR(status); return ERR_PTR(status);
goto done; goto done;
...@@ -405,7 +405,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) ...@@ -405,7 +405,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
} }
ino->flags |= AUTOFS_INF_PENDING; ino->flags |= AUTOFS_INF_PENDING;
spin_unlock(&sbi->fs_lock); spin_unlock(&sbi->fs_lock);
status = autofs4_mount_wait(dentry, 0); status = autofs4_mount_wait(path, 0);
spin_lock(&sbi->fs_lock); spin_lock(&sbi->fs_lock);
ino->flags &= ~AUTOFS_INF_PENDING; ino->flags &= ~AUTOFS_INF_PENDING;
if (status) { if (status) {
...@@ -447,7 +447,7 @@ static int autofs4_d_manage(const struct path *path, bool rcu_walk) ...@@ -447,7 +447,7 @@ static int autofs4_d_manage(const struct path *path, bool rcu_walk)
* This dentry may be under construction so wait on mount * This dentry may be under construction so wait on mount
* completion. * completion.
*/ */
status = autofs4_mount_wait(dentry, rcu_walk); status = autofs4_mount_wait(path, rcu_walk);
if (status) if (status)
return status; return status;
......
...@@ -345,8 +345,9 @@ static int validate_request(struct autofs_wait_queue **wait, ...@@ -345,8 +345,9 @@ static int validate_request(struct autofs_wait_queue **wait,
} }
int autofs4_wait(struct autofs_sb_info *sbi, int autofs4_wait(struct autofs_sb_info *sbi,
struct dentry *dentry, enum autofs_notify notify) const struct path *path, enum autofs_notify notify)
{ {
struct dentry *dentry = path->dentry;
struct autofs_wait_queue *wq; struct autofs_wait_queue *wq;
struct qstr qstr; struct qstr qstr;
char *name; char *name;
......
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