ext3: Fix error handling on inode bitmap corruption
[firefly-linux-kernel-4.4.55.git] / fs / ext3 / ialloc.c
index bfc2dc43681d41c6b54fe405174cc480de1663e9..0b3da7cc8aba919fff46a72b16d63df4d0637269 100644 (file)
@@ -561,8 +561,12 @@ got:
        if (IS_DIRSYNC(inode))
                handle->h_sync = 1;
        if (insert_inode_locked(inode) < 0) {
-               err = -EINVAL;
-               goto fail_drop;
+               /*
+                * Likely a bitmap corruption causing inode to be allocated
+                * twice.
+                */
+               err = -EIO;
+               goto fail;
        }
        spin_lock(&sbi->s_next_gen_lock);
        inode->i_generation = sbi->s_next_generation++;