提交 8d66bf54 编写于 作者: A Al Viro

[PATCH] pass struct path * to do_add_mount()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 d5686b44
...@@ -232,7 +232,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -232,7 +232,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
} }
mntget(newmnt); mntget(newmnt);
err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts); err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts);
switch (err) { switch (err) {
case 0: case 0:
path_put(&nd->path); path_put(&nd->path);
......
...@@ -226,7 +226,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd, ...@@ -226,7 +226,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
int err; int err;
mntget(newmnt); mntget(newmnt);
err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist); err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags, mntlist);
switch (err) { switch (err) {
case 0: case 0:
path_put(&nd->path); path_put(&nd->path);
......
...@@ -1667,31 +1667,31 @@ static noinline int do_new_mount(struct nameidata *nd, char *type, int flags, ...@@ -1667,31 +1667,31 @@ static noinline int do_new_mount(struct nameidata *nd, char *type, int flags,
if (IS_ERR(mnt)) if (IS_ERR(mnt))
return PTR_ERR(mnt); return PTR_ERR(mnt);
return do_add_mount(mnt, nd, mnt_flags, NULL); return do_add_mount(mnt, &nd->path, mnt_flags, NULL);
} }
/* /*
* add a mount into a namespace's mount tree * add a mount into a namespace's mount tree
* - provide the option of adding the new mount to an expiration list * - provide the option of adding the new mount to an expiration list
*/ */
int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, int do_add_mount(struct vfsmount *newmnt, struct path *path,
int mnt_flags, struct list_head *fslist) int mnt_flags, struct list_head *fslist)
{ {
int err; int err;
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(nd->path.dentry) && while (d_mountpoint(path->dentry) &&
follow_down(&nd->path.mnt, &nd->path.dentry)) follow_down(&path->mnt, &path->dentry))
; ;
err = -EINVAL; err = -EINVAL;
if (!check_mnt(nd->path.mnt)) if (!check_mnt(path->mnt))
goto unlock; goto unlock;
/* Refuse the same filesystem on the same mount point */ /* Refuse the same filesystem on the same mount point */
err = -EBUSY; err = -EBUSY;
if (nd->path.mnt->mnt_sb == newmnt->mnt_sb && if (path->mnt->mnt_sb == newmnt->mnt_sb &&
nd->path.mnt->mnt_root == nd->path.dentry) path->mnt->mnt_root == path->dentry)
goto unlock; goto unlock;
err = -EINVAL; err = -EINVAL;
...@@ -1699,7 +1699,7 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, ...@@ -1699,7 +1699,7 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
goto unlock; goto unlock;
newmnt->mnt_flags = mnt_flags; newmnt->mnt_flags = mnt_flags;
if ((err = graft_tree(newmnt, &nd->path))) if ((err = graft_tree(newmnt, path)))
goto unlock; goto unlock;
if (fslist) /* add to the specified expiration list */ if (fslist) /* add to the specified expiration list */
......
...@@ -129,7 +129,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) ...@@ -129,7 +129,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
goto out_err; goto out_err;
mntget(mnt); mntget(mnt);
err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE, err = do_add_mount(mnt, &nd->path, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
&nfs_automount_list); &nfs_automount_list);
if (err < 0) { if (err < 0) {
mntput(mnt); mntput(mnt);
......
...@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, ...@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
struct nameidata; struct nameidata;
extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, struct path;
extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
int mnt_flags, struct list_head *fslist); int mnt_flags, struct list_head *fslist);
extern void mark_mounts_for_expiry(struct list_head *mounts); extern void mark_mounts_for_expiry(struct list_head *mounts);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册