diff --git a/fs/ext4/super.c b/fs/ext4/super.c index b71864390d20849a90efc0bbbc5b8fe03313a05c..5a815773db8847e75fd58b2cd6b2ddcfc111c381 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2228,6 +2228,16 @@ static void ext4_orphan_cleanup(struct super_block *sb, while (es->s_last_orphan) { struct inode *inode; + /* + * We may have encountered an error during cleanup; if + * so, skip the rest. + */ + if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { + jbd_debug(1, "Skipping orphan recovery on fs with errors.\n"); + es->s_last_orphan = 0; + break; + } + inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)); if (IS_ERR(inode)) { es->s_last_orphan = 0;