Commit 9393bd07cf218ca51d0e627653f906a9d76a9131

Authored by Al Viro
1 parent 589ff870ed

switch follow_down()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 12 changed files with 29 additions and 33 deletions Side-by-side Diff

... ... @@ -244,7 +244,7 @@
244 244 case -EBUSY:
245 245 /* someone else made a mount here whilst we were busy */
246 246 while (d_mountpoint(nd->path.dentry) &&
247   - follow_down(&nd->path.mnt, &nd->path.dentry))
  247 + follow_down(&nd->path))
248 248 ;
249 249 err = 0;
250 250 default:
... ... @@ -85,13 +85,12 @@
85 85 }
86 86 path.mnt = mnt;
87 87 path_get(&path);
88   - if (!follow_down(&path.mnt, &path.dentry)) {
  88 + if (!follow_down(&path)) {
89 89 path_put(&path);
90 90 DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
91 91 continue;
92 92 }
93   - while (d_mountpoint(path.dentry) &&
94   - follow_down(&path.mnt, &path.dentry))
  93 + while (d_mountpoint(path.dentry) && follow_down(&path));
95 94 ;
96 95 umount_ok = may_umount(path.mnt);
97 96 path_put(&path);
fs/autofs4/autofs_i.h
... ... @@ -223,12 +223,12 @@
223 223 int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
224 224 void autofs4_catatonic_mode(struct autofs_sb_info *);
225 225  
226   -static inline int autofs4_follow_mount(struct vfsmount **mnt, struct dentry **dentry)
  226 +static inline int autofs4_follow_mount(struct path *path)
227 227 {
228 228 int res = 0;
229 229  
230   - while (d_mountpoint(*dentry)) {
231   - int followed = follow_down(mnt, dentry);
  230 + while (d_mountpoint(path->dentry)) {
  231 + int followed = follow_down(path);
232 232 if (!followed)
233 233 break;
234 234 res = 1;
fs/autofs4/dev-ioctl.c
... ... @@ -562,7 +562,7 @@
562 562 err = have_submounts(path.dentry);
563 563  
564 564 if (path.mnt->mnt_mountpoint != path.mnt->mnt_root) {
565   - if (follow_down(&path.mnt, &path.dentry))
  565 + if (follow_down(&path))
566 566 magic = path.mnt->mnt_sb->s_magic;
567 567 }
568 568 }
... ... @@ -48,19 +48,19 @@
48 48 static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
49 49 {
50 50 struct dentry *top = dentry;
  51 + struct path path = {.mnt = mnt, .dentry = dentry};
51 52 int status = 1;
52 53  
53 54 DPRINTK("dentry %p %.*s",
54 55 dentry, (int)dentry->d_name.len, dentry->d_name.name);
55 56  
56   - mntget(mnt);
57   - dget(dentry);
  57 + path_get(&path);
58 58  
59   - if (!follow_down(&mnt, &dentry))
  59 + if (!follow_down(&path))
60 60 goto done;
61 61  
62   - if (is_autofs4_dentry(dentry)) {
63   - struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
  62 + if (is_autofs4_dentry(path.dentry)) {
  63 + struct autofs_sb_info *sbi = autofs4_sbi(path.dentry->d_sb);
64 64  
65 65 /* This is an autofs submount, we can't expire it */
66 66 if (autofs_type_indirect(sbi->type))
... ... @@ -70,7 +70,7 @@
70 70 * Otherwise it's an offset mount and we need to check
71 71 * if we can umount its mount, if there is one.
72 72 */
73   - if (!d_mountpoint(dentry)) {
  73 + if (!d_mountpoint(path.dentry)) {
74 74 status = 0;
75 75 goto done;
76 76 }
... ... @@ -86,8 +86,7 @@
86 86 status = 0;
87 87 done:
88 88 DPRINTK("returning = %d", status);
89   - dput(dentry);
90   - mntput(mnt);
  89 + path_put(&path);
91 90 return status;
92 91 }
93 92  
... ... @@ -181,7 +181,7 @@
181 181 nd->flags);
182 182 /*
183 183 * For an expire of a covered direct or offset mount we need
184   - * to beeak out of follow_down() at the autofs mount trigger
  184 + * to break out of follow_down() at the autofs mount trigger
185 185 * (d_mounted--), so we can see the expiring flag, and manage
186 186 * the blocking and following here until the expire is completed.
187 187 */
... ... @@ -190,7 +190,7 @@
190 190 if (ino->flags & AUTOFS_INF_EXPIRING) {
191 191 spin_unlock(&sbi->fs_lock);
192 192 /* Follow down to our covering mount. */
193   - if (!follow_down(&nd->path.mnt, &nd->path.dentry))
  193 + if (!follow_down(&nd->path))
194 194 goto done;
195 195 goto follow;
196 196 }
... ... @@ -230,8 +230,7 @@
230 230 * to follow it.
231 231 */
232 232 if (d_mountpoint(dentry)) {
233   - if (!autofs4_follow_mount(&nd->path.mnt,
234   - &nd->path.dentry)) {
  233 + if (!autofs4_follow_mount(&nd->path)) {
235 234 status = -ENOENT;
236 235 goto out_error;
237 236 }
fs/cifs/cifs_dfs_ref.c
... ... @@ -275,7 +275,7 @@
275 275 case -EBUSY:
276 276 /* someone else made a mount here whilst we were busy */
277 277 while (d_mountpoint(nd->path.dentry) &&
278   - follow_down(&nd->path.mnt, &nd->path.dentry))
  278 + follow_down(&nd->path))
279 279 ;
280 280 err = 0;
281 281 default:
... ... @@ -731,16 +731,16 @@
731 731 /* no need for dcache_lock, as serialization is taken care in
732 732 * namespace.c
733 733 */
734   -int follow_down(struct vfsmount **mnt, struct dentry **dentry)
  734 +int follow_down(struct path *path)
735 735 {
736 736 struct vfsmount *mounted;
737 737  
738   - mounted = lookup_mnt(*mnt, *dentry);
  738 + mounted = lookup_mnt(path->mnt, path->dentry);
739 739 if (mounted) {
740   - dput(*dentry);
741   - mntput(*mnt);
742   - *mnt = mounted;
743   - *dentry = dget(mounted->mnt_root);
  740 + dput(path->dentry);
  741 + mntput(path->mnt);
  742 + path->mnt = mounted;
  743 + path->dentry = dget(mounted->mnt_root);
744 744 return 1;
745 745 }
746 746 return 0;
... ... @@ -1601,7 +1601,7 @@
1601 1601  
1602 1602 down_write(&namespace_sem);
1603 1603 while (d_mountpoint(path->dentry) &&
1604   - follow_down(&path->mnt, &path->dentry))
  1604 + follow_down(path))
1605 1605 ;
1606 1606 err = -EINVAL;
1607 1607 if (!check_mnt(path->mnt) || !check_mnt(old_path.mnt))
... ... @@ -1695,7 +1695,7 @@
1695 1695 down_write(&namespace_sem);
1696 1696 /* Something was mounted here while we slept */
1697 1697 while (d_mountpoint(path->dentry) &&
1698   - follow_down(&path->mnt, &path->dentry))
  1698 + follow_down(path))
1699 1699 ;
1700 1700 err = -EINVAL;
1701 1701 if (!(mnt_flags & MNT_SHRINKABLE) && !check_mnt(path->mnt))
... ... @@ -154,7 +154,7 @@
154 154 goto out;
155 155 out_follow:
156 156 while (d_mountpoint(nd->path.dentry) &&
157   - follow_down(&nd->path.mnt, &nd->path.dentry))
  157 + follow_down(&nd->path))
158 158 ;
159 159 err = 0;
160 160 goto out;
... ... @@ -105,8 +105,7 @@
105 105 .dentry = dget(dentry)};
106 106 int err = 0;
107 107  
108   - while (follow_down(&path.mnt, &path.dentry) &&
109   - d_mountpoint(path.dentry))
  108 + while (d_mountpoint(path.dentry) && follow_down(&path))
110 109 ;
111 110  
112 111 exp2 = rqst_exp_get_by_name(rqstp, &path);
include/linux/namei.h
... ... @@ -78,7 +78,7 @@
78 78 extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
79 79 extern struct dentry *lookup_one_noperm(const char *, struct dentry *);
80 80  
81   -extern int follow_down(struct vfsmount **, struct dentry **);
  81 +extern int follow_down(struct path *);
82 82 extern int follow_up(struct path *);
83 83  
84 84 extern struct dentry *lock_rename(struct dentry *, struct dentry *);