tidy up around finish_automount()
do_add_mount() and mnt_clear_expiry() are not needed outside of namespace.c anymore, now that namei has finish_automount() to use. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -71,8 +71,6 @@ extern void release_mounts(struct list_head *);
|
|||||||
extern void umount_tree(struct vfsmount *, int, struct list_head *);
|
extern void umount_tree(struct vfsmount *, int, struct list_head *);
|
||||||
extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);
|
extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);
|
||||||
extern int finish_automount(struct vfsmount *, struct path *);
|
extern int finish_automount(struct vfsmount *, struct path *);
|
||||||
extern int do_add_mount(struct vfsmount *, struct path *, int);
|
|
||||||
extern void mnt_clear_expiry(struct vfsmount *);
|
|
||||||
|
|
||||||
extern void mnt_make_longterm(struct vfsmount *);
|
extern void mnt_make_longterm(struct vfsmount *);
|
||||||
extern void mnt_make_shortterm(struct vfsmount *);
|
extern void mnt_make_shortterm(struct vfsmount *);
|
||||||
|
@@ -1872,6 +1872,8 @@ out:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int do_add_mount(struct vfsmount *, struct path *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a new mount for userspace and request it to be added into the
|
* create a new mount for userspace and request it to be added into the
|
||||||
* namespace's tree
|
* namespace's tree
|
||||||
@@ -1909,25 +1911,31 @@ int finish_automount(struct vfsmount *m, struct path *path)
|
|||||||
|
|
||||||
if (m->mnt_sb == path->mnt->mnt_sb &&
|
if (m->mnt_sb == path->mnt->mnt_sb &&
|
||||||
m->mnt_root == path->dentry) {
|
m->mnt_root == path->dentry) {
|
||||||
mnt_clear_expiry(m);
|
err = -ELOOP;
|
||||||
mntput(m);
|
goto fail;
|
||||||
mntput(m);
|
|
||||||
return -ELOOP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = do_add_mount(m, path, path->mnt->mnt_flags | MNT_SHRINKABLE);
|
err = do_add_mount(m, path, path->mnt->mnt_flags | MNT_SHRINKABLE);
|
||||||
if (err) {
|
if (!err)
|
||||||
mnt_clear_expiry(m);
|
return 0;
|
||||||
mntput(m);
|
fail:
|
||||||
mntput(m);
|
/* remove m from any expiration list it may be on */
|
||||||
|
if (!list_empty(&m->mnt_expire)) {
|
||||||
|
down_write(&namespace_sem);
|
||||||
|
br_write_lock(vfsmount_lock);
|
||||||
|
list_del_init(&m->mnt_expire);
|
||||||
|
br_write_unlock(vfsmount_lock);
|
||||||
|
up_write(&namespace_sem);
|
||||||
}
|
}
|
||||||
|
mntput(m);
|
||||||
|
mntput(m);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add a mount into a namespace's mount tree
|
* add a mount into a namespace's mount tree
|
||||||
*/
|
*/
|
||||||
int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
|
static int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -1954,11 +1962,7 @@ int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
newmnt->mnt_flags = mnt_flags;
|
newmnt->mnt_flags = mnt_flags;
|
||||||
if ((err = graft_tree(newmnt, path)))
|
err = graft_tree(newmnt, path);
|
||||||
goto unlock;
|
|
||||||
|
|
||||||
up_write(&namespace_sem);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
up_write(&namespace_sem);
|
up_write(&namespace_sem);
|
||||||
@@ -1982,20 +1986,6 @@ void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mnt_set_expiry);
|
EXPORT_SYMBOL(mnt_set_expiry);
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove a vfsmount from any expiration list it may be on
|
|
||||||
*/
|
|
||||||
void mnt_clear_expiry(struct vfsmount *mnt)
|
|
||||||
{
|
|
||||||
if (!list_empty(&mnt->mnt_expire)) {
|
|
||||||
down_write(&namespace_sem);
|
|
||||||
br_write_lock(vfsmount_lock);
|
|
||||||
list_del_init(&mnt->mnt_expire);
|
|
||||||
br_write_unlock(vfsmount_lock);
|
|
||||||
up_write(&namespace_sem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* process a list of expirable mountpoints with the intent of discarding any
|
* process a list of expirable mountpoints with the intent of discarding any
|
||||||
* mountpoints that aren't in use and haven't been touched since last we came
|
* mountpoints that aren't in use and haven't been touched since last we came
|
||||||
|
Reference in New Issue
Block a user