Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Howells and committed by
Linus Torvalds
a1d4aebb a90a0880

+30 -34
+30 -34
fs/proc/inode.c
··· 73 73 74 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 76 static struct kmem_cache * proc_inode_cachep; 82 77 83 78 static struct inode *proc_alloc_inode(struct super_block *sb) ··· 123 128 static const struct super_operations proc_sops = { 124 129 .alloc_inode = proc_alloc_inode, 125 130 .destroy_inode = proc_destroy_inode, 126 - .read_inode = proc_read_inode, 127 131 .drop_inode = generic_delete_inode, 128 132 .delete_inode = proc_delete_inode, 129 133 .statfs = simple_statfs, ··· 395 401 if (de != NULL && !try_module_get(de->owner)) 396 402 goto out_mod; 397 403 398 - inode = iget(sb, ino); 404 + inode = iget_locked(sb, ino); 399 405 if (!inode) 400 406 goto out_ino; 401 - 402 - PROC_I(inode)->fd = 0; 403 - PROC_I(inode)->pde = de; 404 - if (de) { 405 - if (de->mode) { 406 - inode->i_mode = de->mode; 407 - inode->i_uid = de->uid; 408 - inode->i_gid = de->gid; 409 - } 410 - if (de->size) 411 - inode->i_size = de->size; 412 - if (de->nlink) 413 - inode->i_nlink = de->nlink; 414 - if (de->proc_iops) 415 - inode->i_op = de->proc_iops; 416 - if (de->proc_fops) { 417 - if (S_ISREG(inode->i_mode)) { 418 - #ifdef CONFIG_COMPAT 419 - if (!de->proc_fops->compat_ioctl) 420 - inode->i_fop = 421 - &proc_reg_file_ops_no_compat; 422 - else 423 - #endif 424 - inode->i_fop = &proc_reg_file_ops; 407 + if (inode->i_state & I_NEW) { 408 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 409 + PROC_I(inode)->fd = 0; 410 + PROC_I(inode)->pde = de; 411 + if (de) { 412 + if (de->mode) { 413 + inode->i_mode = de->mode; 414 + inode->i_uid = de->uid; 415 + inode->i_gid = de->gid; 425 416 } 426 - else 427 - inode->i_fop = de->proc_fops; 417 + if (de->size) 418 + inode->i_size = de->size; 419 + if (de->nlink) 420 + inode->i_nlink = de->nlink; 421 + if (de->proc_iops) 422 + inode->i_op = de->proc_iops; 423 + if (de->proc_fops) { 424 + if (S_ISREG(inode->i_mode)) { 425 + #ifdef CONFIG_COMPAT 426 + if (!de->proc_fops->compat_ioctl) 427 + inode->i_fop = 428 + &proc_reg_file_ops_no_compat; 429 + else 430 + #endif 431 + inode->i_fop = &proc_reg_file_ops; 432 + } else { 433 + inode->i_fop = de->proc_fops; 434 + } 435 + } 428 436 } 437 + unlock_new_inode(inode); 429 438 } 430 - 431 439 return inode; 432 440 433 441 out_ino: