]> Git Repo - linux.git/blobdiff - fs/pnode.c
vfs: spread struct mount - change_mnt_propagation/set_mnt_shared
[linux.git] / fs / pnode.c
index d42514e32380b5edb38f7985069efe8d8ccc80fa..4bd3721867a7b1083c4499391be3eef4b238b0c9 100644 (file)
@@ -28,21 +28,6 @@ static inline struct vfsmount *next_slave(struct vfsmount *p)
        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)
@@ -98,7 +83,7 @@ static int do_make_slave(struct vfsmount *mnt)
                        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;
@@ -129,20 +114,20 @@ static int do_make_slave(struct vfsmount *mnt)
 /*
  * 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;
        }
 }
 
@@ -304,7 +289,8 @@ static inline int do_refcount_check(struct vfsmount *mnt, int count)
  */
 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;
 
@@ -322,8 +308,8 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
        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;
@@ -333,24 +319,24 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
  * 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);
        }
 }
 
@@ -363,9 +349,9 @@ static void __propagate_umount(struct vfsmount *mnt)
  */
 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;
 }
This page took 0.034554 seconds and 4 git commands to generate.