.. | .. |
---|
12 | 12 | struct inode *inode, |
---|
13 | 13 | struct delayed_call *done) |
---|
14 | 14 | { |
---|
15 | | - struct pid_namespace *ns = proc_pid_ns(inode); |
---|
| 15 | + struct pid_namespace *ns = proc_pid_ns(inode->i_sb); |
---|
16 | 16 | pid_t tgid = task_tgid_nr_ns(current, ns); |
---|
17 | 17 | char *name; |
---|
18 | | - |
---|
19 | | - /* |
---|
20 | | - * Not currently supported. Once we can inherit all of struct pid, |
---|
21 | | - * we can allow this. |
---|
22 | | - */ |
---|
23 | | - if (current->flags & PF_KTHREAD) |
---|
24 | | - return ERR_PTR(-EOPNOTSUPP); |
---|
25 | 18 | |
---|
26 | 19 | if (!tgid) |
---|
27 | 20 | return ERR_PTR(-ENOENT); |
---|
.. | .. |
---|
43 | 36 | int proc_setup_self(struct super_block *s) |
---|
44 | 37 | { |
---|
45 | 38 | struct inode *root_inode = d_inode(s->s_root); |
---|
46 | | - struct pid_namespace *ns = proc_pid_ns(root_inode); |
---|
| 39 | + struct proc_fs_info *fs_info = proc_sb_info(s); |
---|
47 | 40 | struct dentry *self; |
---|
48 | | - |
---|
| 41 | + int ret = -ENOMEM; |
---|
| 42 | + |
---|
49 | 43 | inode_lock(root_inode); |
---|
50 | 44 | self = d_alloc_name(s->s_root, "self"); |
---|
51 | 45 | if (self) { |
---|
.. | .. |
---|
58 | 52 | inode->i_gid = GLOBAL_ROOT_GID; |
---|
59 | 53 | inode->i_op = &proc_self_inode_operations; |
---|
60 | 54 | d_add(self, inode); |
---|
| 55 | + ret = 0; |
---|
61 | 56 | } else { |
---|
62 | 57 | dput(self); |
---|
63 | | - self = ERR_PTR(-ENOMEM); |
---|
64 | 58 | } |
---|
65 | | - } else { |
---|
66 | | - self = ERR_PTR(-ENOMEM); |
---|
67 | 59 | } |
---|
68 | 60 | inode_unlock(root_inode); |
---|
69 | | - if (IS_ERR(self)) { |
---|
| 61 | + |
---|
| 62 | + if (ret) |
---|
70 | 63 | pr_err("proc_fill_super: can't allocate /proc/self\n"); |
---|
71 | | - return PTR_ERR(self); |
---|
72 | | - } |
---|
73 | | - ns->proc_self = self; |
---|
74 | | - return 0; |
---|
| 64 | + else |
---|
| 65 | + fs_info->proc_self = self; |
---|
| 66 | + |
---|
| 67 | + return ret; |
---|
75 | 68 | } |
---|
76 | 69 | |
---|
77 | 70 | void __init proc_self_init(void) |
---|