OSDN Git Service

e2fsck: avoid unnecessary reboots in some cases when checking the root fs
authorTheodore Ts'o <tytso@mit.edu>
Sat, 1 Oct 2011 00:59:17 +0000 (20:59 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 1 Oct 2011 03:12:37 +0000 (23:12 -0400)
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>
e2fsck/super.c
tests/f_okgroup/expect.1
tests/r_move_itable/expect
tests/r_resize_inode/expect

index 36e7309..abf8081 100644 (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;
                }
        }
 
index 6f44d89..7d29741 100644 (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
index 7752438..195bb11 100644 (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>
index 3991982..f9f79c4 100644 (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>