From 299d742427776629ef07b4563f41a4e00fc23aa0 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 8 Nov 2002 11:10:28 -0500 Subject: [PATCH] Change e2fsck to force out changes to the backup copies of the superblock and block group descriptors when important changes are made to those data structures. --- e2fsck/ChangeLog | 10 ++++++++++ e2fsck/pass1.c | 1 + e2fsck/super.c | 1 + e2fsck/swapfs.c | 2 ++ 4 files changed, 14 insertions(+) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index b50b25f..8e32eeb 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,13 @@ +2002-11-08 + + * pass1.c (new_table_block), super.c (check_super_block), swapfs.c + (swap_filesys): Clear EXT2_FLAG_MASTER_SB_ONLY to make + sure the backup superblocks and group descriptors are + updated when we make an important change to the + superblocks and/or group descriptors. (i.e., generating a + UUID, allocating filesystem metadata, or byte-swapping the + filesystem.) + 2002-11-07 Theodore Ts'o * e2fsck.h, unix.c (main, check_mount): Fix e2fsck so that it diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 52cdb04..f7ee111 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1732,6 +1732,7 @@ static void new_table_block(e2fsck_t ctx, blk_t first_block, int group, return; } ext2fs_mark_super_dirty(fs); + fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; pctx.blk2 = *new_block; fix_problem(ctx, (old_block ? PR_1_RELOC_FROM_TO : PR_1_RELOC_TO), &pctx); diff --git a/e2fsck/super.c b/e2fsck/super.c index a8ea779..2deff44 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -484,6 +484,7 @@ void check_super_block(e2fsck_t ctx) if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) { uuid_generate(sb->s_uuid); ext2fs_mark_super_dirty(fs); + fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; } } #endif diff --git a/e2fsck/swapfs.c b/e2fsck/swapfs.c index b59079c..de71369 100644 --- a/e2fsck/swapfs.c +++ b/e2fsck/swapfs.c @@ -254,7 +254,9 @@ void swap_filesys(e2fsck_t ctx) ext2fs_swap_bitmap(fs->block_map); fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; #endif + fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; ext2fs_flush(fs); + fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; #ifdef RESOURCE_TRACK if (ctx->options & E2F_OPT_TIME2) -- 1.8.3.1