Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[sfrench/cifs-2.6.git] / fs / ext4 / inode.c
index 40579ef513b716a90729a24ec26c043728a640ae..d251d705c2763ca82aea53e7f9ab41e8f743dbb0 100644 (file)
@@ -4872,13 +4872,6 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
                goto bad_inode;
        raw_inode = ext4_raw_inode(&iloc);
 
-       if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) {
-               ext4_error_inode(inode, function, line, 0,
-                                "iget: root inode unallocated");
-               ret = -EFSCORRUPTED;
-               goto bad_inode;
-       }
-
        if ((flags & EXT4_IGET_HANDLE) &&
            (raw_inode->i_links_count == 0) && (raw_inode->i_mode == 0)) {
                ret = -ESTALE;
@@ -4951,11 +4944,16 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
         * NeilBrown 1999oct15
         */
        if (inode->i_nlink == 0) {
-               if ((inode->i_mode == 0 ||
+               if ((inode->i_mode == 0 || flags & EXT4_IGET_SPECIAL ||
                     !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) &&
                    ino != EXT4_BOOT_LOADER_INO) {
-                       /* this inode is deleted */
-                       ret = -ESTALE;
+                       /* this inode is deleted or unallocated */
+                       if (flags & EXT4_IGET_SPECIAL) {
+                               ext4_error_inode(inode, function, line, 0,
+                                                "iget: special inode unallocated");
+                               ret = -EFSCORRUPTED;
+                       } else
+                               ret = -ESTALE;
                        goto bad_inode;
                }
                /* The only unlinked inodes we let through here have
@@ -5788,7 +5786,7 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
        ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb);
        int gdpblocks;
        int idxblocks;
-       int ret = 0;
+       int ret;
 
        /*
         * How many index blocks need to touch to map @lblocks logical blocks