mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
proc: ->low_ino cleanup
- ->low_ino is write-once field -- reading it under locks is unnecessary. - /proc/$PID stuff never reaches pde_put()/free_proc_entry() -- PROC_DYNAMIC_FIRST check never triggers. - in proc_get_inode(), inode number always matches proc dir entry, so save one parameter. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9d6de12f70
commit
6d1b6e4eff
@ -425,13 +425,10 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
|
|||||||
if (de->namelen != dentry->d_name.len)
|
if (de->namelen != dentry->d_name.len)
|
||||||
continue;
|
continue;
|
||||||
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
|
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
|
||||||
unsigned int ino;
|
|
||||||
|
|
||||||
ino = de->low_ino;
|
|
||||||
pde_get(de);
|
pde_get(de);
|
||||||
spin_unlock(&proc_subdir_lock);
|
spin_unlock(&proc_subdir_lock);
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
inode = proc_get_inode(dir->i_sb, ino, de);
|
inode = proc_get_inode(dir->i_sb, de);
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -768,12 +765,7 @@ EXPORT_SYMBOL(proc_create_data);
|
|||||||
|
|
||||||
static void free_proc_entry(struct proc_dir_entry *de)
|
static void free_proc_entry(struct proc_dir_entry *de)
|
||||||
{
|
{
|
||||||
unsigned int ino = de->low_ino;
|
release_inode_number(de->low_ino);
|
||||||
|
|
||||||
if (ino < PROC_DYNAMIC_FIRST)
|
|
||||||
return;
|
|
||||||
|
|
||||||
release_inode_number(ino);
|
|
||||||
|
|
||||||
if (S_ISLNK(de->mode))
|
if (S_ISLNK(de->mode))
|
||||||
kfree(de->data);
|
kfree(de->data);
|
||||||
|
@ -416,12 +416,11 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
|
struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
|
||||||
struct proc_dir_entry *de)
|
|
||||||
{
|
{
|
||||||
struct inode * inode;
|
struct inode * inode;
|
||||||
|
|
||||||
inode = iget_locked(sb, ino);
|
inode = iget_locked(sb, de->low_ino);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (inode->i_state & I_NEW) {
|
if (inode->i_state & I_NEW) {
|
||||||
@ -471,7 +470,7 @@ int proc_fill_super(struct super_block *s)
|
|||||||
s->s_time_gran = 1;
|
s->s_time_gran = 1;
|
||||||
|
|
||||||
pde_get(&proc_root);
|
pde_get(&proc_root);
|
||||||
root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root);
|
root_inode = proc_get_inode(s, &proc_root);
|
||||||
if (!root_inode)
|
if (!root_inode)
|
||||||
goto out_no_root;
|
goto out_no_root;
|
||||||
root_inode->i_uid = 0;
|
root_inode->i_uid = 0;
|
||||||
|
@ -109,7 +109,7 @@ void pde_put(struct proc_dir_entry *pde);
|
|||||||
|
|
||||||
extern struct vfsmount *proc_mnt;
|
extern struct vfsmount *proc_mnt;
|
||||||
int proc_fill_super(struct super_block *);
|
int proc_fill_super(struct super_block *);
|
||||||
struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *);
|
struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are generic /proc routines that use the internal
|
* These are generic /proc routines that use the internal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user