diff options
-rw-r--r-- | fs/proc/inode.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 1a551d92e1d8..6ecf6396f072 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -73,11 +73,6 @@ static void proc_delete_inode(struct inode *inode) | |||
73 | 73 | ||
74 | struct vfsmount *proc_mnt; | 74 | struct vfsmount *proc_mnt; |
75 | 75 | ||
76 | static void proc_read_inode(struct inode * inode) | ||
77 | { | ||
78 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | ||
79 | } | ||
80 | |||
81 | static struct kmem_cache * proc_inode_cachep; | 76 | static struct kmem_cache * proc_inode_cachep; |
82 | 77 | ||
83 | static struct inode *proc_alloc_inode(struct super_block *sb) | 78 | static struct inode *proc_alloc_inode(struct super_block *sb) |
@@ -128,7 +123,6 @@ static int proc_remount(struct super_block *sb, int *flags, char *data) | |||
128 | static const struct super_operations proc_sops = { | 123 | static const struct super_operations proc_sops = { |
129 | .alloc_inode = proc_alloc_inode, | 124 | .alloc_inode = proc_alloc_inode, |
130 | .destroy_inode = proc_destroy_inode, | 125 | .destroy_inode = proc_destroy_inode, |
131 | .read_inode = proc_read_inode, | ||
132 | .drop_inode = generic_delete_inode, | 126 | .drop_inode = generic_delete_inode, |
133 | .delete_inode = proc_delete_inode, | 127 | .delete_inode = proc_delete_inode, |
134 | .statfs = simple_statfs, | 128 | .statfs = simple_statfs, |
@@ -401,39 +395,41 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, | |||
401 | if (de != NULL && !try_module_get(de->owner)) | 395 | if (de != NULL && !try_module_get(de->owner)) |
402 | goto out_mod; | 396 | goto out_mod; |
403 | 397 | ||
404 | inode = iget(sb, ino); | 398 | inode = iget_locked(sb, ino); |
405 | if (!inode) | 399 | if (!inode) |
406 | goto out_ino; | 400 | goto out_ino; |
407 | 401 | if (inode->i_state & I_NEW) { | |
408 | PROC_I(inode)->fd = 0; | 402 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
409 | PROC_I(inode)->pde = de; | 403 | PROC_I(inode)->fd = 0; |
410 | if (de) { | 404 | PROC_I(inode)->pde = de; |
411 | if (de->mode) { | 405 | if (de) { |
412 | inode->i_mode = de->mode; | 406 | if (de->mode) { |
413 | inode->i_uid = de->uid; | 407 | inode->i_mode = de->mode; |
414 | inode->i_gid = de->gid; | 408 | inode->i_uid = de->uid; |
415 | } | 409 | inode->i_gid = de->gid; |
416 | if (de->size) | 410 | } |
417 | inode->i_size = de->size; | 411 | if (de->size) |
418 | if (de->nlink) | 412 | inode->i_size = de->size; |
419 | inode->i_nlink = de->nlink; | 413 | if (de->nlink) |
420 | if (de->proc_iops) | 414 | inode->i_nlink = de->nlink; |
421 | inode->i_op = de->proc_iops; | 415 | if (de->proc_iops) |
422 | if (de->proc_fops) { | 416 | inode->i_op = de->proc_iops; |
423 | if (S_ISREG(inode->i_mode)) { | 417 | if (de->proc_fops) { |
418 | if (S_ISREG(inode->i_mode)) { | ||
424 | #ifdef CONFIG_COMPAT | 419 | #ifdef CONFIG_COMPAT |
425 | if (!de->proc_fops->compat_ioctl) | 420 | if (!de->proc_fops->compat_ioctl) |
426 | inode->i_fop = | 421 | inode->i_fop = |
427 | &proc_reg_file_ops_no_compat; | 422 | &proc_reg_file_ops_no_compat; |
428 | else | 423 | else |
429 | #endif | 424 | #endif |
430 | inode->i_fop = &proc_reg_file_ops; | 425 | inode->i_fop = &proc_reg_file_ops; |
426 | } else { | ||
427 | inode->i_fop = de->proc_fops; | ||
428 | } | ||
431 | } | 429 | } |
432 | else | ||
433 | inode->i_fop = de->proc_fops; | ||
434 | } | 430 | } |
431 | unlock_new_inode(inode); | ||
435 | } | 432 | } |
436 | |||
437 | return inode; | 433 | return inode; |
438 | 434 | ||
439 | out_ino: | 435 | out_ino: |