Whamcloud - gitweb
ext2fs_flushfs: Remove the NEEDS_RECOVERY from the backup superblocks
authorTheodore Ts'o <tytso@mit.edu>
Sun, 16 Dec 2007 00:39:37 +0000 (19:39 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 16 Dec 2007 00:39:37 +0000 (19:39 -0500)
Now that e2fsck tries to backup the primary superblock to the backups
when the feature sets ar different, it's important when tune2fs writes
out a changed superblock, that we filter out the
EXT3_FEATURE_INCOMPAT_RECOVER feature to the backup superblocks, since
it will be removed from the primary superblock either when the
filesystem is mounted uncleanly or when journal is replayed.

Addresses-Debian-Bug: #454926

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/closefs.c

index f3fe533..88c515a 100644 (file)
@@ -208,6 +208,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        dgrp_t          i,j;
        errcode_t       retval;
        unsigned long   fs_state;
+       __u32           feature_incompat;
        struct ext2_super_block *super_shadow = 0;
        struct ext2_group_desc *group_shadow = 0;
        struct ext2_group_desc *s, *t;
@@ -217,6 +218,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
        fs_state = fs->super->s_state;
+       feature_incompat = fs->super->s_feature_incompat;
 
        fs->super->s_wtime = fs->now ? fs->now : time(NULL);
        fs->super->s_block_group_nr = 0;
@@ -254,6 +256,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
         * we write out the backup superblocks.)
         */
        fs->super->s_state &= ~EXT2_VALID_FS;
+       fs->super->s_feature_incompat &= ~EXT3_FEATURE_INCOMPAT_RECOVER;
 #ifdef EXT2FS_ENABLE_SWAPFS
        if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
                *super_shadow = *fs->super;
@@ -332,6 +335,7 @@ write_primary_superblock_only:
 
        fs->super->s_block_group_nr = 0;
        fs->super->s_state = fs_state;
+       fs->super->s_feature_incompat = feature_incompat;
 #ifdef EXT2FS_ENABLE_SWAPFS
        if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
                *super_shadow = *fs->super;