return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave);
}
-/*
- * Return true if path is reachable from root
- *
- * namespace_sem is held, and mnt is attached
- */
-static bool is_path_reachable(struct vfsmount *mnt, struct dentry *dentry,
- const struct path *root)
-{
- while (mnt != root->mnt && mnt->mnt_parent != mnt) {
- dentry = mnt->mnt_mountpoint;
- mnt = mnt->mnt_parent;
- }
- return mnt == root->mnt && is_subdir(dentry, root->dentry);
-}
-
static struct vfsmount *get_peer_under_root(struct vfsmount *mnt,
struct mnt_namespace *ns,
const struct path *root)
peer_mnt = NULL;
}
if (IS_MNT_SHARED(mnt) && list_empty(&mnt->mnt_share))
- mnt_release_group_id(mnt);
+ mnt_release_group_id(real_mount(mnt));
list_del_init(&mnt->mnt_share);
mnt->mnt_group_id = 0;
/*
* vfsmount lock must be held for write
*/
-void change_mnt_propagation(struct vfsmount *mnt, int type)
+void change_mnt_propagation(struct mount *mnt, int type)
{
if (type == MS_SHARED) {
set_mnt_shared(mnt);
return;
}
- do_make_slave(mnt);
+ do_make_slave(&mnt->mnt);
if (type != MS_SLAVE) {
- list_del_init(&mnt->mnt_slave);
- mnt->mnt_master = NULL;
+ list_del_init(&mnt->mnt.mnt_slave);
+ mnt->mnt.mnt_master = NULL;
if (type == MS_UNBINDABLE)
- mnt->mnt_flags |= MNT_UNBINDABLE;
+ mnt->mnt.mnt_flags |= MNT_UNBINDABLE;
else
- mnt->mnt_flags &= ~MNT_UNBINDABLE;
+ mnt->mnt.mnt_flags &= ~MNT_UNBINDABLE;
}
}
*/
int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
{
- struct vfsmount *m, *child;
+ struct vfsmount *m;
+ struct mount *child;
struct vfsmount *parent = mnt->mnt_parent;
int ret = 0;
for (m = propagation_next(parent, parent); m;
m = propagation_next(m, parent)) {
child = __lookup_mnt(m, mnt->mnt_mountpoint, 0);
- if (child && list_empty(&child->mnt_mounts) &&
- (ret = do_refcount_check(child, 1)))
+ if (child && list_empty(&child->mnt.mnt_mounts) &&
+ (ret = do_refcount_check(&child->mnt, 1)))
break;
}
return ret;
* NOTE: unmounting 'mnt' naturally propagates to all other mounts its
* parent propagates to.
*/
-static void __propagate_umount(struct vfsmount *mnt)
+static void __propagate_umount(struct mount *mnt)
{
- struct vfsmount *parent = mnt->mnt_parent;
+ struct vfsmount *parent = mnt->mnt.mnt_parent;
struct vfsmount *m;
- BUG_ON(parent == mnt);
+ BUG_ON(parent == &mnt->mnt);
for (m = propagation_next(parent, parent); m;
m = propagation_next(m, parent)) {
- struct vfsmount *child = __lookup_mnt(m,
- mnt->mnt_mountpoint, 0);
+ struct mount *child = __lookup_mnt(m,
+ mnt->mnt.mnt_mountpoint, 0);
/*
* umount the child only if the child has no
* other children
*/
- if (child && list_empty(&child->mnt_mounts))
- list_move_tail(&child->mnt_hash, &mnt->mnt_hash);
+ if (child && list_empty(&child->mnt.mnt_mounts))
+ list_move_tail(&child->mnt.mnt_hash, &mnt->mnt.mnt_hash);
}
}
*/
int propagate_umount(struct list_head *list)
{
- struct vfsmount *mnt;
+ struct mount *mnt;
- list_for_each_entry(mnt, list, mnt_hash)
+ list_for_each_entry(mnt, list, mnt.mnt_hash)
__propagate_umount(mnt);
return 0;
}