]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ext3: skip orphan cleanup on rocompat fs
authorAmir Goldstein <amir73il@gmail.com>
Sat, 26 Feb 2011 20:40:19 +0000 (22:40 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 28 Mar 2011 14:31:20 +0000 (07:31 -0700)
commit ce654b37f87980d95f339080e4c3bdb2370bdf22 upstream.

Orphan cleanup is currently executed even if the file system has some
number of unknown ROCOMPAT features, which deletes inodes and frees
blocks, which could be very bad for some RO_COMPAT features.

This patch skips the orphan cleanup if it contains readonly compatible
features not known by this ext3 implementation, which would prevent
the fs from being mounted (or remounted) readwrite.

Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext3/super.c

index afa2b569da101094dee07e58fda0f40391f8e045..76f5d57133720df5b8a9bad3f02b9510b2a80876 100644 (file)
@@ -1440,6 +1440,13 @@ static void ext3_orphan_cleanup (struct super_block * sb,
                return;
        }
 
+       /* Check if feature set allows readwrite operations */
+       if (EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP)) {
+               ext3_msg(sb, KERN_INFO, "Skipping orphan cleanup due to "
+                        "unknown ROCOMPAT features");
+               return;
+       }
+
        if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
                if (es->s_last_orphan)
                        jbd_debug(1, "Errors on filesystem, "