]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
switch follow_down()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 18 Apr 2009 17:58:15 +0000 (13:58 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Jun 2009 01:36:01 +0000 (21:36 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 files changed:
fs/afs/mntpt.c
fs/autofs/dirhash.c
fs/autofs4/autofs_i.h
fs/autofs4/dev-ioctl.c
fs/autofs4/expire.c
fs/autofs4/root.c
fs/cifs/cifs_dfs_ref.c
fs/namei.c
fs/namespace.c
fs/nfs/namespace.c
fs/nfsd/vfs.c
include/linux/namei.h

index 2b9e2d03a3902d686940339ce349f88e9af51324..c52be53f694628e7a618b6a0405394b582050aca 100644 (file)
@@ -244,7 +244,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
        case -EBUSY:
                /* someone else made a mount here whilst we were busy */
                while (d_mountpoint(nd->path.dentry) &&
-                      follow_down(&nd->path.mnt, &nd->path.dentry))
+                      follow_down(&nd->path))
                        ;
                err = 0;
        default:
index 4eb4d8dfb2f183016fbf97139afd92b4e70714f8..2316e944a109d9daa82a322c566e8621087e2098 100644 (file)
@@ -85,13 +85,12 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
                }
                path.mnt = mnt;
                path_get(&path);
-               if (!follow_down(&path.mnt, &path.dentry)) {
+               if (!follow_down(&path)) {
                        path_put(&path);
                        DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
                        continue;
                }
-               while (d_mountpoint(path.dentry) &&
-                      follow_down(&path.mnt, &path.dentry))
+               while (d_mountpoint(path.dentry) && follow_down(&path));
                        ;
                umount_ok = may_umount(path.mnt);
                path_put(&path);
index b7ff33c63101545c17410c220a2e6c0f5ab51994..8f7cdde4173358575b292088c7f085d71ba66232 100644 (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);
 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;
 
-       while (d_mountpoint(*dentry)) {
-               int followed = follow_down(mnt, dentry);
+       while (d_mountpoint(path->dentry)) {
+               int followed = follow_down(path);
                if (!followed)
                        break;
                res = 1;
index 670407576b255954628ba85a55459e2e7c9bedd8..f3da2eb51f56a2c02e579a76517a6547c1ca65e2 100644 (file)
@@ -562,7 +562,7 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
                err = have_submounts(path.dentry);
 
                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;
                }
        }
index 3077d8f16523010a5aaaf90d017900bd723aa12a..aa39ae83f0193da10f0b218954ae8ec9cf149cb3 100644 (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)
 {
        struct dentry *top = dentry;
+       struct path path = {.mnt = mnt, .dentry = dentry};
        int status = 1;
 
        DPRINTK("dentry %p %.*s",
                dentry, (int)dentry->d_name.len, dentry->d_name.name);
 
-       mntget(mnt);
-       dget(dentry);
+       path_get(&path);
 
-       if (!follow_down(&mnt, &dentry))
+       if (!follow_down(&path))
                goto done;
 
-       if (is_autofs4_dentry(dentry)) {
-               struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+       if (is_autofs4_dentry(path.dentry)) {
+               struct autofs_sb_info *sbi = autofs4_sbi(path.dentry->d_sb);
 
                /* This is an autofs submount, we can't expire it */
                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
                 * if we can umount its mount, if there is one.
                 */
-               if (!d_mountpoint(dentry)) {
+               if (!d_mountpoint(path.dentry)) {
                        status = 0;
                        goto done;
                }
@@ -86,8 +86,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
        status = 0;
 done:
        DPRINTK("returning = %d", status);
-       dput(dentry);
-       mntput(mnt);
+       path_put(&path);
        return status;
 }
 
index e383bf0334f173c8c0a381ef2b2c50964931c62c..b96a3c57359d71a73b6698f8d4d1269b116ceaee 100644 (file)
@@ -181,7 +181,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
                nd->flags);
        /*
         * 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
         * 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) {
                        spin_unlock(&sbi->fs_lock);
                        /* Follow down to our covering mount. */
-                       if (!follow_down(&nd->path.mnt, &nd->path.dentry))
+                       if (!follow_down(&nd->path))
                                goto done;
                        goto follow;
                }
@@ -230,8 +230,7 @@ follow:
         * to follow it.
         */
        if (d_mountpoint(dentry)) {
-               if (!autofs4_follow_mount(&nd->path.mnt,
-                                         &nd->path.dentry)) {
+               if (!autofs4_follow_mount(&nd->path)) {
                        status = -ENOENT;
                        goto out_error;
                }
index 83d62759c7c7a42537674faa4b05958292076c08..3bb11be8b6a8210271368fc8b6c44942c77a02a7 100644 (file)
@@ -275,7 +275,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
        case -EBUSY:
                /* someone else made a mount here whilst we were busy */
                while (d_mountpoint(nd->path.dentry) &&
-                      follow_down(&nd->path.mnt, &nd->path.dentry))
+                      follow_down(&nd->path))
                        ;
                err = 0;
        default:
index 8c1f48ae68e7c6e1193b8e371e88ac4599b0a493..4d49a3eee6d43f4f21756cd5e181c15469584b23 100644 (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
  * namespace.c
  */
-int follow_down(struct vfsmount **mnt, struct dentry **dentry)
+int follow_down(struct path *path)
 {
        struct vfsmount *mounted;
 
-       mounted = lookup_mnt(*mnt, *dentry);
+       mounted = lookup_mnt(path->mnt, path->dentry);
        if (mounted) {
-               dput(*dentry);
-               mntput(*mnt);
-               *mnt = mounted;
-               *dentry = dget(mounted->mnt_root);
+               dput(path->dentry);
+               mntput(path->mnt);
+               path->mnt = mounted;
+               path->dentry = dget(mounted->mnt_root);
                return 1;
        }
        return 0;
index c85962206aad645200b6138db550c74b4e610874..ba5237be1cf982e1953ffe829d79742a3e73c30e 100644 (file)
@@ -1601,7 +1601,7 @@ static int do_move_mount(struct path *path, char *old_name)
 
        down_write(&namespace_sem);
        while (d_mountpoint(path->dentry) &&
-              follow_down(&path->mnt, &path->dentry))
+              follow_down(path))
                ;
        err = -EINVAL;
        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);
        /* Something was mounted here while we slept */
        while (d_mountpoint(path->dentry) &&
-              follow_down(&path->mnt, &path->dentry))
+              follow_down(path))
                ;
        err = -EINVAL;
        if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(path->mnt))
index 64a288ee046d027692f1dc395792609cfe1760aa..f01caec844634329b1204cb3d331724c18d1881f 100644 (file)
@@ -154,7 +154,7 @@ out_err:
        goto out;
 out_follow:
        while (d_mountpoint(nd->path.dentry) &&
-              follow_down(&nd->path.mnt, &nd->path.dentry))
+              follow_down(&nd->path))
                ;
        err = 0;
        goto out;
index 7b2b3f775326c837200a4e430c1b5357399cfc63..99f835753596914a419a53a824c912a830f6a0df 100644 (file)
@@ -105,8 +105,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
                            .dentry = dget(dentry)};
        int err = 0;
 
-       while (follow_down(&path.mnt, &path.dentry) &&
-              d_mountpoint(path.dentry))
+       while (d_mountpoint(path.dentry) && follow_down(&path))
                ;
 
        exp2 = rqst_exp_get_by_name(rqstp, &path);
index 9cd5a717be3b2a1265003443f9cc2b3d0aa5a8bc..d870ae2faedc7d8b7de668adb1e3e2464fdda685 100644 (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_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 struct dentry *lock_rename(struct dentry *, struct dentry *);