From: Theodore Ts'o Date: Sat, 1 Oct 2011 00:59:17 +0000 (-0400) Subject: e2fsck: avoid unnecessary reboots in some cases when checking the root fs X-Git-Tag: v1.42-WIP-1001~3 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=86db36abfb3e9ec77c482e02ed8de073de4148e3;p=tools%2Fe2fsprogs.git 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" --- diff --git a/e2fsck/super.c b/e2fsck/super.c index 36e7309..abf8081 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 6f44d89..7d29741 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 7752438..195bb11 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 3991982..f9f79c4 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: