~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to fs/proc/root.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
static int proc_set_super(struct super_block *sb, void *data)
30
30
{
31
 
        struct pid_namespace *ns;
32
 
 
33
 
        ns = (struct pid_namespace *)data;
34
 
        sb->s_fs_info = get_pid_ns(ns);
35
 
        return set_anon_super(sb, NULL);
 
31
        int err = set_anon_super(sb, NULL);
 
32
        if (!err) {
 
33
                struct pid_namespace *ns = (struct pid_namespace *)data;
 
34
                sb->s_fs_info = get_pid_ns(ns);
 
35
        }
 
36
        return err;
36
37
}
37
38
 
38
39
static struct dentry *proc_mount(struct file_system_type *fs_type,
43
44
        struct pid_namespace *ns;
44
45
        struct proc_inode *ei;
45
46
 
46
 
        if (proc_mnt) {
47
 
                /* Seed the root directory with a pid so it doesn't need
48
 
                 * to be special in base.c.  I would do this earlier but
49
 
                 * the only task alive when /proc is mounted the first time
50
 
                 * is the init_task and it doesn't have any pids.
51
 
                 */
52
 
                ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode);
53
 
                if (!ei->pid)
54
 
                        ei->pid = find_get_pid(1);
55
 
        }
56
 
 
57
47
        if (flags & MS_KERNMOUNT)
58
48
                ns = (struct pid_namespace *)data;
59
49
        else
71
61
                        return ERR_PTR(err);
72
62
                }
73
63
 
74
 
                ei = PROC_I(sb->s_root->d_inode);
75
 
                if (!ei->pid) {
76
 
                        rcu_read_lock();
77
 
                        ei->pid = get_pid(find_pid_ns(1, ns));
78
 
                        rcu_read_unlock();
79
 
                }
80
 
 
81
64
                sb->s_flags |= MS_ACTIVE;
82
65
        }
83
66
 
 
67
        ei = PROC_I(sb->s_root->d_inode);
 
68
        if (!ei->pid) {
 
69
                rcu_read_lock();
 
70
                ei->pid = get_pid(find_pid_ns(1, ns));
 
71
                rcu_read_unlock();
 
72
        }
 
73
 
84
74
        return dget(sb->s_root);
85
75
}
86
76
 
101
91
 
102
92
void __init proc_root_init(void)
103
93
{
 
94
        struct vfsmount *mnt;
104
95
        int err;
105
96
 
106
97
        proc_init_inodecache();
107
98
        err = register_filesystem(&proc_fs_type);
108
99
        if (err)
109
100
                return;
110
 
        proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
111
 
        if (IS_ERR(proc_mnt)) {
 
101
        mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
 
102
        if (IS_ERR(mnt)) {
112
103
                unregister_filesystem(&proc_fs_type);
113
104
                return;
114
105
        }
115
106
 
116
 
        init_pid_ns.proc_mnt = proc_mnt;
 
107
        init_pid_ns.proc_mnt = mnt;
117
108
        proc_symlink("mounts", NULL, "self/mounts");
118
109
 
119
110
        proc_net_init();