iget: stop PROCFS from using iget() and read_inode()
Stop the PROCFS filesystem from using iget() and read_inode(). Merge procfs_read_inode() into procfs_get_inode(), and have that call iget_locked() instead of iget(). [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: David Howells <dhowells@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a90a088021
commit
a1d4aebbfa
|
@ -73,11 +73,6 @@ static void proc_delete_inode(struct inode *inode)
|
||||||
|
|
||||||
struct vfsmount *proc_mnt;
|
struct vfsmount *proc_mnt;
|
||||||
|
|
||||||
static void proc_read_inode(struct inode * inode)
|
|
||||||
{
|
|
||||||
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kmem_cache * proc_inode_cachep;
|
static struct kmem_cache * proc_inode_cachep;
|
||||||
|
|
||||||
static struct inode *proc_alloc_inode(struct super_block *sb)
|
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)
|
||||||
static const struct super_operations proc_sops = {
|
static const struct super_operations proc_sops = {
|
||||||
.alloc_inode = proc_alloc_inode,
|
.alloc_inode = proc_alloc_inode,
|
||||||
.destroy_inode = proc_destroy_inode,
|
.destroy_inode = proc_destroy_inode,
|
||||||
.read_inode = proc_read_inode,
|
|
||||||
.drop_inode = generic_delete_inode,
|
.drop_inode = generic_delete_inode,
|
||||||
.delete_inode = proc_delete_inode,
|
.delete_inode = proc_delete_inode,
|
||||||
.statfs = simple_statfs,
|
.statfs = simple_statfs,
|
||||||
|
@ -401,39 +395,41 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
|
||||||
if (de != NULL && !try_module_get(de->owner))
|
if (de != NULL && !try_module_get(de->owner))
|
||||||
goto out_mod;
|
goto out_mod;
|
||||||
|
|
||||||
inode = iget(sb, ino);
|
inode = iget_locked(sb, ino);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
goto out_ino;
|
goto out_ino;
|
||||||
|
if (inode->i_state & I_NEW) {
|
||||||
PROC_I(inode)->fd = 0;
|
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
|
||||||
PROC_I(inode)->pde = de;
|
PROC_I(inode)->fd = 0;
|
||||||
if (de) {
|
PROC_I(inode)->pde = de;
|
||||||
if (de->mode) {
|
if (de) {
|
||||||
inode->i_mode = de->mode;
|
if (de->mode) {
|
||||||
inode->i_uid = de->uid;
|
inode->i_mode = de->mode;
|
||||||
inode->i_gid = de->gid;
|
inode->i_uid = de->uid;
|
||||||
}
|
inode->i_gid = de->gid;
|
||||||
if (de->size)
|
}
|
||||||
inode->i_size = de->size;
|
if (de->size)
|
||||||
if (de->nlink)
|
inode->i_size = de->size;
|
||||||
inode->i_nlink = de->nlink;
|
if (de->nlink)
|
||||||
if (de->proc_iops)
|
inode->i_nlink = de->nlink;
|
||||||
inode->i_op = de->proc_iops;
|
if (de->proc_iops)
|
||||||
if (de->proc_fops) {
|
inode->i_op = de->proc_iops;
|
||||||
if (S_ISREG(inode->i_mode)) {
|
if (de->proc_fops) {
|
||||||
#ifdef CONFIG_COMPAT
|
if (S_ISREG(inode->i_mode)) {
|
||||||
if (!de->proc_fops->compat_ioctl)
|
#ifdef CONFIG_COMPAT
|
||||||
inode->i_fop =
|
if (!de->proc_fops->compat_ioctl)
|
||||||
&proc_reg_file_ops_no_compat;
|
inode->i_fop =
|
||||||
else
|
&proc_reg_file_ops_no_compat;
|
||||||
#endif
|
else
|
||||||
inode->i_fop = &proc_reg_file_ops;
|
#endif
|
||||||
|
inode->i_fop = &proc_reg_file_ops;
|
||||||
|
} else {
|
||||||
|
inode->i_fop = de->proc_fops;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
inode->i_fop = de->proc_fops;
|
|
||||||
}
|
}
|
||||||
|
unlock_new_inode(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return inode;
|
return inode;
|
||||||
|
|
||||||
out_ino:
|
out_ino:
|
||||||
|
|
Loading…
Reference in New Issue