Re: [PATCH] Add pidfs filesystem

From: kbuild test robot
Date: Sat Feb 18 2017 - 18:36:06 EST


Hi Alexey,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc8 next-20170217]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Alexey-Gladkov/Add-pidfs-filesystem/20170219-070129
config: x86_64-randconfig-x001-201708 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

fs/proc/root.c: In function 'proc_kill_sb':
>> fs/proc/root.c:107:9: error: 'struct pid_namespace' has no member named 'pidfs_self'; did you mean 'proc_self'?
if (ns->pidfs_self)
^~
fs/proc/root.c:108:11: error: 'struct pid_namespace' has no member named 'pidfs_self'; did you mean 'proc_self'?
dput(ns->pidfs_self);
^~
>> fs/proc/root.c:110:9: error: 'struct pid_namespace' has no member named 'pidfs_thread_self'; did you mean 'proc_thread_self'?
if (ns->pidfs_thread_self)
^~
fs/proc/root.c:111:11: error: 'struct pid_namespace' has no member named 'pidfs_thread_self'; did you mean 'proc_thread_self'?
dput(ns->pidfs_thread_self);
^~
fs/proc/root.c: In function 'pid_ns_prepare_proc':
>> fs/proc/root.c:282:5: error: 'struct pid_namespace' has no member named 'pidfs_mnt'; did you mean 'proc_mnt'?
ns->pidfs_mnt = mnt;
^~
fs/proc/root.c: In function 'pid_ns_release_proc':
fs/proc/root.c:292:18: error: 'struct pid_namespace' has no member named 'pidfs_mnt'; did you mean 'proc_mnt'?
kern_unmount(ns->pidfs_mnt);
^~
--
fs/proc/self.c: In function 'proc_setup_self':
>> fs/proc/self.c:66:5: error: 'struct pid_namespace' has no member named 'pidfs_self'; did you mean 'proc_self'?
ns->pidfs_self = self;
^~
--
fs/proc/thread_self.c: In function 'proc_setup_thread_self':
>> fs/proc/thread_self.c:67:5: error: 'struct pid_namespace' has no member named 'pidfs_thread_self'; did you mean 'proc_thread_self'?
ns->pidfs_thread_self = thread_self;
^~

vim +107 fs/proc/root.c

101 {
102 struct pid_namespace *ns;
103
104 ns = (struct pid_namespace *)sb->s_fs_info;
105
106 if (IS_ENABLED(CONFIG_PROC_PIDFS) && sb->s_type == &pidfs_fs_type) {
> 107 if (ns->pidfs_self)
108 dput(ns->pidfs_self);
109
> 110 if (ns->pidfs_thread_self)
111 dput(ns->pidfs_thread_self);
112 } else {
113 if (ns->proc_self)
114 dput(ns->proc_self);
115
116 if (ns->proc_thread_self)
117 dput(ns->proc_thread_self);
118 }
119
120 kill_anon_super(sb);
121 put_pid_ns(ns);
122 }
123
124 static struct file_system_type proc_fs_type = {
125 .name = "proc",
126 .mount = proc_mount,
127 .kill_sb = proc_kill_sb,
128 .fs_flags = FS_USERNS_MOUNT,
129 };
130
131 struct file_system_type pidfs_fs_type = {
132 .name = "pidfs",
133 .mount = proc_mount,
134 .kill_sb = proc_kill_sb,
135 .fs_flags = FS_USERNS_MOUNT,
136 };
137
138 void __init proc_root_init(void)
139 {
140 int err;
141
142 proc_init_inodecache();
143 set_proc_pid_nlink();
144 err = register_filesystem(&proc_fs_type);
145 if (err)
146 return;
147
148 err = register_filesystem(&pidfs_fs_type);
149 if (err)
150 return;
151
152 proc_self_init();
153 proc_thread_self_init();
154 proc_symlink("mounts", NULL, "self/mounts");
155
156 proc_net_init();
157
158 #ifdef CONFIG_SYSVIPC
159 proc_mkdir("sysvipc", NULL);
160 #endif
161 proc_mkdir("fs", NULL);
162 proc_mkdir("driver", NULL);
163 proc_create_mount_point("fs/nfsd"); /* somewhere for the nfsd filesystem to be mounted */
164 #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)
165 /* just give it a mountpoint */
166 proc_create_mount_point("openprom");
167 #endif
168 proc_tty_init();
169 proc_mkdir("bus", NULL);
170 proc_sys_init();
171 }
172
173 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
174 {
175 generic_fillattr(d_inode(dentry), stat);
176 stat->nlink = proc_root.nlink + nr_processes();
177 return 0;
178 }
179
180 static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags)
181 {
182 if (!proc_pid_lookup(dir, dentry, flags))
183 return NULL;
184
185 return proc_lookup(dir, dentry, flags);
186 }
187
188 static int proc_root_readdir(struct file *file, struct dir_context *ctx)
189 {
190 if (ctx->pos < FIRST_PROCESS_ENTRY) {
191 int error = proc_readdir(file, ctx);
192 if (unlikely(error <= 0))
193 return error;
194 ctx->pos = FIRST_PROCESS_ENTRY;
195 }
196
197 return proc_pid_readdir(file, ctx);
198 }
199
200 static int pidfs_root_readdir(struct file *file, struct dir_context *ctx)
201 {
202 if (ctx->pos < FIRST_PROCESS_ENTRY)
203 ctx->pos = FIRST_PROCESS_ENTRY;
204
205 return proc_pid_readdir(file, ctx);
206 }
207
208 /*
209 * The root /proc directory is special, as it has the
210 * <pid> directories. Thus we don't use the generic
211 * directory handling functions for that..
212 */
213 static const struct file_operations proc_root_operations = {
214 .read = generic_read_dir,
215 .iterate_shared = proc_root_readdir,
216 .llseek = generic_file_llseek,
217 };
218
219 static const struct file_operations pidfs_root_operations = {
220 .read = generic_read_dir,
221 .iterate_shared = pidfs_root_readdir,
222 .llseek = generic_file_llseek,
223 };
224
225 /*
226 * proc root can do almost nothing..
227 */
228 static const struct inode_operations proc_root_inode_operations = {
229 .lookup = proc_root_lookup,
230 .getattr = proc_root_getattr,
231 };
232
233 static const struct inode_operations pidfs_root_inode_operations = {
234 .lookup = proc_pid_lookup,
235 .getattr = proc_root_getattr,
236 };
237
238 /*
239 * This is the root "inode" in the /proc tree..
240 */
241 struct proc_dir_entry proc_root = {
242 .low_ino = PROC_ROOT_INO,
243 .namelen = 5,
244 .mode = S_IFDIR | S_IRUGO | S_IXUGO,
245 .nlink = 2,
246 .count = ATOMIC_INIT(1),
247 .proc_iops = &proc_root_inode_operations,
248 .proc_fops = &proc_root_operations,
249 .parent = &proc_root,
250 .subdir = RB_ROOT,
251 .name = "/proc",
252 };
253
254 struct proc_dir_entry pidfs_root = {
255 .low_ino = PROC_ROOT_INO,
256 .namelen = 6,
257 .mode = S_IFDIR | S_IRUGO | S_IXUGO,
258 .nlink = 2,
259 .count = ATOMIC_INIT(1),
260 .proc_iops = &pidfs_root_inode_operations,
261 .proc_fops = &pidfs_root_operations,
262 .parent = &pidfs_root,
263 .subdir = RB_ROOT,
264 .name = "/pidfs",
265 };
266
267 int pid_ns_prepare_proc(struct pid_namespace *ns)
268 {
269 struct vfsmount *mnt;
270
271 mnt = kern_mount_data(&proc_fs_type, ns);
272 if (IS_ERR(mnt))
273 return PTR_ERR(mnt);
274
275 ns->proc_mnt = mnt;
276
277 if (IS_ENABLED(CONFIG_PROC_PIDFS)) {
278 mnt = kern_mount_data(&pidfs_fs_type, ns);
279 if (IS_ERR(mnt))
280 return PTR_ERR(mnt);
281
> 282 ns->pidfs_mnt = mnt;
283 }
284 return 0;
285 }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip