aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-25 20:11:22 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:14 -0500
commitd3d009cb965eae7e002ea5badf603ea8f4c34915 (patch)
tree624a97e06717507d4246da2369b684d4ebd6e0a9 /fs/proc/inode.c
parent87e0aab37ff6c4284810a48d6034314fbf4eb319 (diff)
saner proc_get_inode() calling conventions
Make it drop the pde in *all* cases when no new reference to it is put into an inode - both when an inode had already been set up (as we were already doing) and when inode allocation has failed. Makes for simpler logics in callers... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r--fs/proc/inode.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 98a7d2870bef..70322e1a4f0f 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -445,12 +445,9 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
445 445
446struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) 446struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
447{ 447{
448 struct inode * inode; 448 struct inode *inode = iget_locked(sb, de->low_ino);
449 449
450 inode = iget_locked(sb, de->low_ino); 450 if (inode && (inode->i_state & I_NEW)) {
451 if (!inode)
452 return NULL;
453 if (inode->i_state & I_NEW) {
454 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 451 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
455 PROC_I(inode)->pde = de; 452 PROC_I(inode)->pde = de;
456 453
@@ -482,7 +479,7 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
482 } else 479 } else
483 pde_put(de); 480 pde_put(de);
484 return inode; 481 return inode;
485} 482}
486 483
487int proc_fill_super(struct super_block *s) 484int proc_fill_super(struct super_block *s)
488{ 485{
@@ -499,7 +496,6 @@ int proc_fill_super(struct super_block *s)
499 root_inode = proc_get_inode(s, &proc_root); 496 root_inode = proc_get_inode(s, &proc_root);
500 if (!root_inode) { 497 if (!root_inode) {
501 printk(KERN_ERR "proc_fill_super: get root inode failed\n"); 498 printk(KERN_ERR "proc_fill_super: get root inode failed\n");
502 pde_put(&proc_root);
503 return -ENOMEM; 499 return -ENOMEM;
504 } 500 }
505 501