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" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2011-09-30 20:59:17 -04:00
parent 9c58eaf7d3
commit 86db36abfb
4 changed files with 9 additions and 19 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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: <none>
@ -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: <none>
@ -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: <none>

View File

@ -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: <none>