Whamcloud - gitweb
e2fsck: update the bg_checksum after fixing problems in the bg descriptor
authorTheodore Ts'o <tytso@mit.edu>
Sat, 11 Dec 2021 03:40:40 +0000 (22:40 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Dec 2021 03:40:40 +0000 (22:40 -0500)
Otherwise, we break the block group descriptor's checksum, and while
this gets fixed by e2fsck, it results unnecessary messages printed or
questions asked of the system administrator.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass2.c
tests/f_uninit_inode_past_unused/expect.1
tests/f_uninit_restart_fsck/expect.1
tests/f_unused_itable/expect.1

index cb80d33..3b473af 100644 (file)
@@ -1539,6 +1539,7 @@ skip_checksum:
                                        &cd->pctx)){
                                ext2fs_bg_flags_clear(fs, group,
                                                      EXT2_BG_INODE_UNINIT);
+                               ext2fs_group_desc_csum_set(fs, group);
                                ext2fs_mark_super_dirty(fs);
                                ctx->flags |= E2F_FLAG_RESTART_LATER;
                        } else {
@@ -1550,6 +1551,7 @@ skip_checksum:
                        pctx.num = dirent->inode;
                        if (fix_problem(ctx, PR_2_INOREF_IN_UNUSED, &cd->pctx)){
                                ext2fs_bg_itable_unused_set(fs, group, 0);
+                               ext2fs_group_desc_csum_set(fs, group);
                                ext2fs_mark_super_dirty(fs);
                                ctx->flags |= E2F_FLAG_RESTART_LATER;
                        } else {
index 1cf5c85..de1ac23 100644 (file)
@@ -4,9 +4,6 @@ Entry 'foo' in / (2) references inode 14 found in group 0's unused inodes area.
 Fix? yes
 
 Restarting e2fsck from the beginning...
-One or more block group descriptor checksums are invalid.  Fix? yes
-
-Group descriptor 0 checksum is 0x4c72, should be 0xde74.  FIXED.
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
index d396beb..64a2d06 100644 (file)
@@ -13,10 +13,6 @@ Entry 'bar2' in /d2 (3761) has an incorrect filetype (was 1, should be 0).
 Fix? yes
 
 Restarting e2fsck from the beginning...
-One or more block group descriptor checksums are invalid.  Fix? yes
-
-Group descriptor 0 checksum is 0xb92b, should be 0x2b5f.  FIXED.
-Group descriptor 1 checksum is 0x2f53, should be 0x8d2f.  FIXED.
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Entry 'foo2' in /d1 (1881) has deleted/unused inode 500.  Clear? yes
index a4da987..ffda3c4 100644 (file)
@@ -7,10 +7,6 @@ Entry '1' in / (2) references inode 12 found in group 0's unused inodes area.
 Fix? yes
 
 Restarting e2fsck from the beginning...
-One or more block group descriptor checksums are invalid.  Fix? yes
-
-Group descriptor 0 checksum is 0x289d, should be 0x788a.  FIXED.
-Group descriptor 1 checksum is 0xfaab, should be 0x3a9a.  FIXED.
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity