]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/pnode.c
[patch 6/7] vfs: mountinfo: add /proc/<pid>/mountinfo
[net-next-2.6.git] / fs / pnode.c
index 89940f243fc235d2f2f8d9abf27e5b0f6862cd52..d18d66491a01ab5de2684b056692c424c0159c4f 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/mnt_namespace.h>
 #include <linux/mount.h>
 #include <linux/fs.h>
+#include "internal.h"
 #include "pnode.h"
 
 /* return the next shared peer mount of @p */
@@ -45,7 +46,11 @@ static int do_make_slave(struct vfsmount *mnt)
                if (peer_mnt == mnt)
                        peer_mnt = NULL;
        }
+       if (IS_MNT_SHARED(mnt) && list_empty(&mnt->mnt_share))
+               mnt_release_group_id(mnt);
+
        list_del_init(&mnt->mnt_share);
+       mnt->mnt_group_id = 0;
 
        if (peer_mnt)
                master = peer_mnt;
@@ -67,7 +72,6 @@ static int do_make_slave(struct vfsmount *mnt)
        }
        mnt->mnt_master = master;
        CLEAR_MNT_SHARED(mnt);
-       INIT_LIST_HEAD(&mnt->mnt_slave_list);
        return 0;
 }
 
@@ -83,6 +87,8 @@ void change_mnt_propagation(struct vfsmount *mnt, int type)
                mnt->mnt_master = NULL;
                if (type == MS_UNBINDABLE)
                        mnt->mnt_flags |= MNT_UNBINDABLE;
+               else
+                       mnt->mnt_flags &= ~MNT_UNBINDABLE;
        }
 }
 
@@ -209,8 +215,7 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
 out:
        spin_lock(&vfsmount_lock);
        while (!list_empty(&tmp_list)) {
-               child = list_entry(tmp_list.next, struct vfsmount, mnt_hash);
-               list_del_init(&child->mnt_hash);
+               child = list_first_entry(&tmp_list, struct vfsmount, mnt_hash);
                umount_tree(child, 0, &umount_list);
        }
        spin_unlock(&vfsmount_lock);
@@ -223,7 +228,7 @@ out:
  */
 static inline int do_refcount_check(struct vfsmount *mnt, int count)
 {
-       int mycount = atomic_read(&mnt->mnt_count);
+       int mycount = atomic_read(&mnt->mnt_count) - mnt->mnt_ghosts;
        return (mycount > count);
 }