Skip to content

Commit 8d66bf5

Browse files
author
Al Viro
committed
[PATCH] pass struct path * to do_add_mount()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent d5686b4 commit 8d66bf5

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎fs/afs/mntpt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
232232
}
233233

234234
mntget(newmnt);
235-
err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
235+
err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts);
236236
switch (err) {
237237
case 0:
238238
path_put(&nd->path);

‎fs/cifs/cifs_dfs_ref.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
226226
int err;
227227

228228
mntget(newmnt);
229-
err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
229+
err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags, mntlist);
230230
switch (err) {
231231
case 0:
232232
path_put(&nd->path);

‎fs/namespace.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,39 +1667,39 @@ static noinline int do_new_mount(struct nameidata *nd, char *type, int flags,
16671667
if (IS_ERR(mnt))
16681668
return PTR_ERR(mnt);
16691669

1670-
return do_add_mount(mnt, nd, mnt_flags, NULL);
1670+
return do_add_mount(mnt, &nd->path, mnt_flags, NULL);
16711671
}
16721672

16731673
/*
16741674
* add a mount into a namespace's mount tree
16751675
* - provide the option of adding the new mount to an expiration list
16761676
*/
1677-
int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
1677+
int do_add_mount(struct vfsmount *newmnt, struct path *path,
16781678
int mnt_flags, struct list_head *fslist)
16791679
{
16801680
int err;
16811681

16821682
down_write(&namespace_sem);
16831683
/* Something was mounted here while we slept */
1684-
while (d_mountpoint(nd->path.dentry) &&
1685-
follow_down(&nd->path.mnt, &nd->path.dentry))
1684+
while (d_mountpoint(path->dentry) &&
1685+
follow_down(&path->mnt, &path->dentry))
16861686
;
16871687
err = -EINVAL;
1688-
if (!check_mnt(nd->path.mnt))
1688+
if (!check_mnt(path->mnt))
16891689
goto unlock;
16901690

16911691
/* Refuse the same filesystem on the same mount point */
16921692
err = -EBUSY;
1693-
if (nd->path.mnt->mnt_sb == newmnt->mnt_sb &&
1694-
nd->path.mnt->mnt_root == nd->path.dentry)
1693+
if (path->mnt->mnt_sb == newmnt->mnt_sb &&
1694+
path->mnt->mnt_root == path->dentry)
16951695
goto unlock;
16961696

16971697
err = -EINVAL;
16981698
if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))
16991699
goto unlock;
17001700

17011701
newmnt->mnt_flags = mnt_flags;
1702-
if ((err = graft_tree(newmnt, &nd->path)))
1702+
if ((err = graft_tree(newmnt, path)))
17031703
goto unlock;
17041704

17051705
if (fslist) /* add to the specified expiration list */

‎fs/nfs/namespace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
129129
goto out_err;
130130

131131
mntget(mnt);
132-
err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
132+
err = do_add_mount(mnt, &nd->path, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
133133
&nfs_automount_list);
134134
if (err < 0) {
135135
mntput(mnt);

‎include/linux/mount.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
105105

106106
struct nameidata;
107107

108-
extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
108+
struct path;
109+
extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
109110
int mnt_flags, struct list_head *fslist);
110111

111112
extern void mark_mounts_for_expiry(struct list_head *mounts);

0 commit comments

Comments
 (0)