aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r--fs/ext3/inode.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 8a9ce2d09bde..eb95670a27eb 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -2654,21 +2654,31 @@ void ext3_get_inode_flags(struct ext3_inode_info *ei)
2654 ei->i_flags |= EXT3_DIRSYNC_FL; 2654 ei->i_flags |= EXT3_DIRSYNC_FL;
2655} 2655}
2656 2656
2657void ext3_read_inode(struct inode * inode) 2657struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
2658{ 2658{
2659 struct ext3_iloc iloc; 2659 struct ext3_iloc iloc;
2660 struct ext3_inode *raw_inode; 2660 struct ext3_inode *raw_inode;
2661 struct ext3_inode_info *ei = EXT3_I(inode); 2661 struct ext3_inode_info *ei;
2662 struct buffer_head *bh; 2662 struct buffer_head *bh;
2663 struct inode *inode;
2664 long ret;
2663 int block; 2665 int block;
2664 2666
2667 inode = iget_locked(sb, ino);
2668 if (!inode)
2669 return ERR_PTR(-ENOMEM);
2670 if (!(inode->i_state & I_NEW))
2671 return inode;
2672
2673 ei = EXT3_I(inode);
2665#ifdef CONFIG_EXT3_FS_POSIX_ACL 2674#ifdef CONFIG_EXT3_FS_POSIX_ACL
2666 ei->i_acl = EXT3_ACL_NOT_CACHED; 2675 ei->i_acl = EXT3_ACL_NOT_CACHED;
2667 ei->i_default_acl = EXT3_ACL_NOT_CACHED; 2676 ei->i_default_acl = EXT3_ACL_NOT_CACHED;
2668#endif 2677#endif
2669 ei->i_block_alloc_info = NULL; 2678 ei->i_block_alloc_info = NULL;
2670 2679
2671 if (__ext3_get_inode_loc(inode, &iloc, 0)) 2680 ret = __ext3_get_inode_loc(inode, &iloc, 0);
2681 if (ret < 0)
2672 goto bad_inode; 2682 goto bad_inode;
2673 bh = iloc.bh; 2683 bh = iloc.bh;
2674 raw_inode = ext3_raw_inode(&iloc); 2684 raw_inode = ext3_raw_inode(&iloc);
@@ -2699,6 +2709,7 @@ void ext3_read_inode(struct inode * inode)
2699 !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) { 2709 !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) {
2700 /* this inode is deleted */ 2710 /* this inode is deleted */
2701 brelse (bh); 2711 brelse (bh);
2712 ret = -ESTALE;
2702 goto bad_inode; 2713 goto bad_inode;
2703 } 2714 }
2704 /* The only unlinked inodes we let through here have 2715 /* The only unlinked inodes we let through here have
@@ -2742,6 +2753,7 @@ void ext3_read_inode(struct inode * inode)
2742 if (EXT3_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > 2753 if (EXT3_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
2743 EXT3_INODE_SIZE(inode->i_sb)) { 2754 EXT3_INODE_SIZE(inode->i_sb)) {
2744 brelse (bh); 2755 brelse (bh);
2756 ret = -EIO;
2745 goto bad_inode; 2757 goto bad_inode;
2746 } 2758 }
2747 if (ei->i_extra_isize == 0) { 2759 if (ei->i_extra_isize == 0) {
@@ -2783,11 +2795,12 @@ void ext3_read_inode(struct inode * inode)
2783 } 2795 }
2784 brelse (iloc.bh); 2796 brelse (iloc.bh);
2785 ext3_set_inode_flags(inode); 2797 ext3_set_inode_flags(inode);
2786 return; 2798 unlock_new_inode(inode);
2799 return inode;
2787 2800
2788bad_inode: 2801bad_inode:
2789 make_bad_inode(inode); 2802 iget_failed(inode);
2790 return; 2803 return ERR_PTR(ret);
2791} 2804}
2792 2805
2793/* 2806/*