]> Pileus Git - ~andy/linux/blobdiff - fs/proc/root.c
Merge branch 'sh-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / fs / proc / root.c
index ef9fa8e24ad65f9b13a2a4cb989a14466ac3db8b..a9000e9cfee54ac804eb71e75d0b72bf989041ed 100644 (file)
@@ -43,17 +43,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
        struct pid_namespace *ns;
        struct proc_inode *ei;
 
-       if (proc_mnt) {
-               /* Seed the root directory with a pid so it doesn't need
-                * to be special in base.c.  I would do this earlier but
-                * the only task alive when /proc is mounted the first time
-                * is the init_task and it doesn't have any pids.
-                */
-               ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode);
-               if (!ei->pid)
-                       ei->pid = find_get_pid(1);
-       }
-
        if (flags & MS_KERNMOUNT)
                ns = (struct pid_namespace *)data;
        else
@@ -71,16 +60,16 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
                        return ERR_PTR(err);
                }
 
-               ei = PROC_I(sb->s_root->d_inode);
-               if (!ei->pid) {
-                       rcu_read_lock();
-                       ei->pid = get_pid(find_pid_ns(1, ns));
-                       rcu_read_unlock();
-               }
-
                sb->s_flags |= MS_ACTIVE;
        }
 
+       ei = PROC_I(sb->s_root->d_inode);
+       if (!ei->pid) {
+               rcu_read_lock();
+               ei->pid = get_pid(find_pid_ns(1, ns));
+               rcu_read_unlock();
+       }
+
        return dget(sb->s_root);
 }
 
@@ -101,19 +90,20 @@ static struct file_system_type proc_fs_type = {
 
 void __init proc_root_init(void)
 {
+       struct vfsmount *mnt;
        int err;
 
        proc_init_inodecache();
        err = register_filesystem(&proc_fs_type);
        if (err)
                return;
-       proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
-       if (IS_ERR(proc_mnt)) {
+       mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
+       if (IS_ERR(mnt)) {
                unregister_filesystem(&proc_fs_type);
                return;
        }
 
-       init_pid_ns.proc_mnt = proc_mnt;
+       init_pid_ns.proc_mnt = mnt;
        proc_symlink("mounts", NULL, "self/mounts");
 
        proc_net_init();