tags 454926 +pending
thanks

On Wed, Dec 12, 2007 at 12:35:58PM +0000, Alun wrote:
> In the past I've never had problems running tune2fs on live filesystems,
> but it seems that the new checks don't like it. It looks like 
> tune2fs is only modifying the first superblock, which sounds wrong to
> me.

Actually tune2fs was modifying all of the superblocks, but the problem
was it was writing the NEEDS_RECOVERY (which is treated as an incompat
feature flag) to all of the superblocks, since the filesystem was
mounted at the time.  Later on, the NEEDS_RECOVERY flag is getting
cleared when the filesystem cleanly unmounted, or when the journal is
replayed.  But then the primary superblock's feature set looks
different from the backup's, and this triggers e2fsck to do a full
backup followed the superblock backup.

The fix is to never write out the NEEDS_RECOVERY flag to the backup
superblock.

                                                - Ted

commit 9a083af71a2388ae47252f8af2b796f9055f4af7
Author: Theodore Ts'o <[EMAIL PROTECTED]>
Date:   Sat Dec 15 19:39:37 2007 -0500

    ext2fs_flushfs: Remove the NEEDS_RECOVERY from the backup superblocks
    
    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" <[EMAIL PROTECTED]>

diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index f3fe533..88c515a 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -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;



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to