From d3d009cb965eae7e002ea5badf603ea8f4c34915 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 25 Jan 2013 20:11:22 -0500 Subject: 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 --- fs/proc/inode.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'fs/proc/inode.c') 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 = { struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) { - struct inode * inode; + struct inode *inode = iget_locked(sb, de->low_ino); - inode = iget_locked(sb, de->low_ino); - if (!inode) - return NULL; - if (inode->i_state & I_NEW) { + if (inode && (inode->i_state & I_NEW)) { inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; PROC_I(inode)->pde = de; @@ -482,7 +479,7 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) } else pde_put(de); return inode; -} +} int proc_fill_super(struct super_block *s) { @@ -499,7 +496,6 @@ int proc_fill_super(struct super_block *s) root_inode = proc_get_inode(s, &proc_root); if (!root_inode) { printk(KERN_ERR "proc_fill_super: get root inode failed\n"); - pde_put(&proc_root); return -ENOMEM; } -- cgit v1.2.3