From 86db36abfb3e9ec77c482e02ed8de073de4148e3 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 30 Sep 2011 20:59:17 -0400 Subject: [PATCH] e2fsck: avoid unnecessary reboots in some cases when checking the root fs If e2fsck modifies certain superblock fields which the kernel doesn't look at, mark the superblock as dirty without marking the file system as changed. This will avoid e2fsck signalling the init scripts that a reboot is necessary. This is safe, because the kernel doesn't actually look at these superblock fields. Signed-off-by: "Theodore Ts'o" --- e2fsck/super.c | 8 ++++---- tests/f_okgroup/expect.1 | 4 +--- tests/r_move_itable/expect | 12 +++--------- tests/r_resize_inode/expect | 4 +--- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/e2fsck/super.c b/e2fsck/super.c index 36e7309c..abf80819 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -719,7 +719,7 @@ void check_super_block(e2fsck_t ctx) if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) { if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) { uuid_generate(sb->s_uuid); - ext2fs_mark_super_dirty(fs); + fs->flags |= EXT2_FLAG_DIRTY; fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; } } @@ -737,7 +737,7 @@ void check_super_block(e2fsck_t ctx) (fs_proc_check("ext4") || check_for_modules("ext4"))) { if (fix_problem(ctx, PR_0_CLEAR_TESTFS_FLAG, &pctx)) { fs->super->s_flags &= ~EXT2_FLAGS_TEST_FILESYS; - ext2fs_mark_super_dirty(fs); + fs->flags |= EXT2_FLAG_DIRTY; fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; } } @@ -826,7 +826,7 @@ void check_super_block(e2fsck_t ctx) problem = PR_0_FUTURE_SB_LAST_MOUNT_FUDGED; if (fix_problem(ctx, problem, &pctx)) { fs->super->s_mtime = ctx->now; - ext2fs_mark_super_dirty(fs); + fs->flags |= EXT2_FLAG_DIRTY; } } if (!broken_system_clock && @@ -838,7 +838,7 @@ void check_super_block(e2fsck_t ctx) problem = PR_0_FUTURE_SB_LAST_WRITE_FUDGED; if (fix_problem(ctx, problem, &pctx)) { fs->super->s_wtime = ctx->now; - ext2fs_mark_super_dirty(fs); + fs->flags |= EXT2_FLAG_DIRTY; } } diff --git a/tests/f_okgroup/expect.1 b/tests/f_okgroup/expect.1 index 6f44d891..7d29741f 100644 --- a/tests/f_okgroup/expect.1 +++ b/tests/f_okgroup/expect.1 @@ -5,7 +5,5 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** test_filesys: 11/2048 files (0.0% non-contiguous), 274/8193 blocks -Exit status is 1 +Exit status is 0 diff --git a/tests/r_move_itable/expect b/tests/r_move_itable/expect index 7752438f..195bb114 100644 --- a/tests/r_move_itable/expect +++ b/tests/r_move_itable/expect @@ -309,10 +309,8 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** test_filesys: 11/2496 files (0.0% non-contiguous), 1644/19969 blocks -Exit status is 1 +Exit status is 0 dumpe2fs test.img Filesystem volume name: @@ -846,10 +844,8 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** test_filesys: 11/3744 files (0.0% non-contiguous), 2007/29953 blocks -Exit status is 1 +Exit status is 0 dumpe2fs test.img Filesystem volume name: @@ -1619,10 +1615,8 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** test_filesys: 11/5024 files (0.0% non-contiguous), 2376/40000 blocks -Exit status is 1 +Exit status is 0 dumpe2fs test.img Filesystem volume name: diff --git a/tests/r_resize_inode/expect b/tests/r_resize_inode/expect index 39919827..f9f79c46 100644 --- a/tests/r_resize_inode/expect +++ b/tests/r_resize_inode/expect @@ -611,10 +611,8 @@ Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** test_filesys: 11/41472 files (0.0% non-contiguous), 8361/165536 blocks -Exit status is 1 +Exit status is 0 dumpe2fs test.img Filesystem volume name: