2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-18 23:54:26 +08:00

switch follow_down()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2009-04-18 13:58:15 -04:00
parent 589ff870ed
commit 9393bd07cf
12 changed files with 29 additions and 33 deletions

View File

@ -244,7 +244,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
case -EBUSY: case -EBUSY:
/* someone else made a mount here whilst we were busy */ /* someone else made a mount here whilst we were busy */
while (d_mountpoint(nd->path.dentry) && while (d_mountpoint(nd->path.dentry) &&
follow_down(&nd->path.mnt, &nd->path.dentry)) follow_down(&nd->path))
; ;
err = 0; err = 0;
default: default:

View File

@ -85,13 +85,12 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
} }
path.mnt = mnt; path.mnt = mnt;
path_get(&path); path_get(&path);
if (!follow_down(&path.mnt, &path.dentry)) { if (!follow_down(&path)) {
path_put(&path); path_put(&path);
DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name)); DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
continue; continue;
} }
while (d_mountpoint(path.dentry) && while (d_mountpoint(path.dentry) && follow_down(&path));
follow_down(&path.mnt, &path.dentry))
; ;
umount_ok = may_umount(path.mnt); umount_ok = may_umount(path.mnt);
path_put(&path); path_put(&path);

View File

@ -223,12 +223,12 @@ int autofs4_wait(struct autofs_sb_info *,struct dentry *, 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 *);
static inline int autofs4_follow_mount(struct vfsmount **mnt, struct dentry **dentry) static inline int autofs4_follow_mount(struct path *path)
{ {
int res = 0; int res = 0;
while (d_mountpoint(*dentry)) { while (d_mountpoint(path->dentry)) {
int followed = follow_down(mnt, dentry); int followed = follow_down(path);
if (!followed) if (!followed)
break; break;
res = 1; res = 1;

View File

@ -562,7 +562,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
err = have_submounts(path.dentry); err = have_submounts(path.dentry);
if (path.mnt->mnt_mountpoint != path.mnt->mnt_root) { if (path.mnt->mnt_mountpoint != path.mnt->mnt_root) {
if (follow_down(&path.mnt, &path.dentry)) if (follow_down(&path))
magic = path.mnt->mnt_sb->s_magic; magic = path.mnt->mnt_sb->s_magic;
} }
} }

View File

@ -48,19 +48,19 @@ static inline int autofs4_can_expire(struct dentry *dentry,
static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
{ {
struct dentry *top = dentry; struct dentry *top = dentry;
struct path path = {.mnt = mnt, .dentry = dentry};
int status = 1; int status = 1;
DPRINTK("dentry %p %.*s", DPRINTK("dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name); dentry, (int)dentry->d_name.len, dentry->d_name.name);
mntget(mnt); path_get(&path);
dget(dentry);
if (!follow_down(&mnt, &dentry)) if (!follow_down(&path))
goto done; goto done;
if (is_autofs4_dentry(dentry)) { if (is_autofs4_dentry(path.dentry)) {
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); struct autofs_sb_info *sbi = autofs4_sbi(path.dentry->d_sb);
/* This is an autofs submount, we can't expire it */ /* This is an autofs submount, we can't expire it */
if (autofs_type_indirect(sbi->type)) if (autofs_type_indirect(sbi->type))
@ -70,7 +70,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
* Otherwise it's an offset mount and we need to check * Otherwise it's an offset mount and we need to check
* if we can umount its mount, if there is one. * if we can umount its mount, if there is one.
*/ */
if (!d_mountpoint(dentry)) { if (!d_mountpoint(path.dentry)) {
status = 0; status = 0;
goto done; goto done;
} }
@ -86,8 +86,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
status = 0; status = 0;
done: done:
DPRINTK("returning = %d", status); DPRINTK("returning = %d", status);
dput(dentry); path_put(&path);
mntput(mnt);
return status; return status;
} }

View File

@ -181,7 +181,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
nd->flags); nd->flags);
/* /*
* For an expire of a covered direct or offset mount we need * For an expire of a covered direct or offset mount we need
* to beeak out of follow_down() at the autofs mount trigger * to break out of follow_down() at the autofs mount trigger
* (d_mounted--), so we can see the expiring flag, and manage * (d_mounted--), so we can see the expiring flag, and manage
* the blocking and following here until the expire is completed. * the blocking and following here until the expire is completed.
*/ */
@ -190,7 +190,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
if (ino->flags & AUTOFS_INF_EXPIRING) { if (ino->flags & AUTOFS_INF_EXPIRING) {
spin_unlock(&sbi->fs_lock); spin_unlock(&sbi->fs_lock);
/* Follow down to our covering mount. */ /* Follow down to our covering mount. */
if (!follow_down(&nd->path.mnt, &nd->path.dentry)) if (!follow_down(&nd->path))
goto done; goto done;
goto follow; goto follow;
} }
@ -230,8 +230,7 @@ follow:
* to follow it. * to follow it.
*/ */
if (d_mountpoint(dentry)) { if (d_mountpoint(dentry)) {
if (!autofs4_follow_mount(&nd->path.mnt, if (!autofs4_follow_mount(&nd->path)) {
&nd->path.dentry)) {
status = -ENOENT; status = -ENOENT;
goto out_error; goto out_error;
} }

View File

@ -275,7 +275,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
case -EBUSY: case -EBUSY:
/* someone else made a mount here whilst we were busy */ /* someone else made a mount here whilst we were busy */
while (d_mountpoint(nd->path.dentry) && while (d_mountpoint(nd->path.dentry) &&
follow_down(&nd->path.mnt, &nd->path.dentry)) follow_down(&nd->path))
; ;
err = 0; err = 0;
default: default:

View File

@ -731,16 +731,16 @@ static void follow_mount(struct vfsmount **mnt, struct dentry **dentry)
/* no need for dcache_lock, as serialization is taken care in /* no need for dcache_lock, as serialization is taken care in
* namespace.c * namespace.c
*/ */
int follow_down(struct vfsmount **mnt, struct dentry **dentry) int follow_down(struct path *path)
{ {
struct vfsmount *mounted; struct vfsmount *mounted;
mounted = lookup_mnt(*mnt, *dentry); mounted = lookup_mnt(path->mnt, path->dentry);
if (mounted) { if (mounted) {
dput(*dentry); dput(path->dentry);
mntput(*mnt); mntput(path->mnt);
*mnt = mounted; path->mnt = mounted;
*dentry = dget(mounted->mnt_root); path->dentry = dget(mounted->mnt_root);
return 1; return 1;
} }
return 0; return 0;

View File

@ -1601,7 +1601,7 @@ static int do_move_mount(struct path *path, char *old_name)
down_write(&namespace_sem); down_write(&namespace_sem);
while (d_mountpoint(path->dentry) && while (d_mountpoint(path->dentry) &&
follow_down(&path->mnt, &path->dentry)) follow_down(path))
; ;
err = -EINVAL; err = -EINVAL;
if (!check_mnt(path->mnt) || !check_mnt(old_path.mnt)) if (!check_mnt(path->mnt) || !check_mnt(old_path.mnt))
@ -1695,7 +1695,7 @@ int do_add_mount(struct vfsmount *newmnt, struct path *path,
down_write(&namespace_sem); down_write(&namespace_sem);
/* Something was mounted here while we slept */ /* Something was mounted here while we slept */
while (d_mountpoint(path->dentry) && while (d_mountpoint(path->dentry) &&
follow_down(&path->mnt, &path->dentry)) follow_down(path))
; ;
err = -EINVAL; err = -EINVAL;
if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(path->mnt)) if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(path->mnt))

View File

@ -154,7 +154,7 @@ out_err:
goto out; goto out;
out_follow: out_follow:
while (d_mountpoint(nd->path.dentry) && while (d_mountpoint(nd->path.dentry) &&
follow_down(&nd->path.mnt, &nd->path.dentry)) follow_down(&nd->path))
; ;
err = 0; err = 0;
goto out; goto out;

View File

@ -105,8 +105,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
.dentry = dget(dentry)}; .dentry = dget(dentry)};
int err = 0; int err = 0;
while (follow_down(&path.mnt, &path.dentry) && while (d_mountpoint(path.dentry) && follow_down(&path))
d_mountpoint(path.dentry))
; ;
exp2 = rqst_exp_get_by_name(rqstp, &path); exp2 = rqst_exp_get_by_name(rqstp, &path);

View File

@ -78,7 +78,7 @@ extern void release_open_intent(struct nameidata *);
extern struct dentry *lookup_one_len(const char *, struct dentry *, int); extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
extern struct dentry *lookup_one_noperm(const char *, struct dentry *); extern struct dentry *lookup_one_noperm(const char *, struct dentry *);
extern int follow_down(struct vfsmount **, struct dentry **); extern int follow_down(struct path *);
extern int follow_up(struct path *); extern int follow_up(struct path *);
extern struct dentry *lock_rename(struct dentry *, struct dentry *); extern struct dentry *lock_rename(struct dentry *, struct dentry *);