]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: only complain about no-checksum directory blocks once
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 14 Dec 2014 02:55:12 +0000 (21:55 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 14 Dec 2014 02:55:12 +0000 (21:55 -0500)
If a directory block lacks space for a checksum and the user directs
e2fsck to fix the directory block (by rehashing it), don't complain a
second time about the checksum verification failure when we get to the
end of the directory block.

Also, don't complain about broken HTREE directories if we're already
planning to rebuild the HTREE directory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass2.c
tests/f_dir_bad_csum/expect.1

index cd0762a0c9fbdbb16c1811154dcbc35c9b2bf358..7aaebce8f51eabd148c3cd6f4891a76a219e36a8 100644 (file)
@@ -166,7 +166,8 @@ void e2fsck_pass2(e2fsck_t ctx)
        for (i=0; (dx_dir = e2fsck_dx_dir_info_iter(ctx, &i)) != 0;) {
                if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
                        return;
-               if (dx_dir->numblocks == 0)
+               if (e2fsck_dir_will_be_rehashed(ctx, dx_dir->ino) ||
+                   dx_dir->numblocks == 0)
                        continue;
                clear_problem_context(&pctx);
                bad_dir = 0;
@@ -1022,11 +1023,15 @@ out_htree:
        if (is_leaf && !inline_data_size && failed_csum &&
            !ext2fs_dirent_has_tail(fs, (struct ext2_dir_entry *)buf)) {
                de_csum_size = 0;
-               if (e2fsck_dir_will_be_rehashed(ctx, ino) ||
-                   !fix_problem(cd->ctx, PR_2_LEAF_NODE_MISSING_CSUM,
+               if (e2fsck_dir_will_be_rehashed(ctx, ino)) {
+                       failed_csum = 0;
+                       goto skip_checksum;
+               }
+               if (!fix_problem(cd->ctx, PR_2_LEAF_NODE_MISSING_CSUM,
                                 &cd->pctx))
                        goto skip_checksum;
                e2fsck_rehash_dir_later(ctx, ino);
+               failed_csum = 0;
                goto skip_checksum;
        }
        /* htree nodes don't use fake dirents to store checksums */
index bbcbfcb3166a467e75e29c5b364b58ba414a3bdb..b2b2faeb42f0614ef1e40451745b19b7f99b34f7 100644 (file)
@@ -6,15 +6,9 @@ Fix? yes
 Directory inode 13, block #0, offset 0: directory has no checksum.
 Fix? yes
 
-Directory inode 13, block #0, offset 1012: directory passes checks but fails checksum.
-Fix? yes
-
 Directory inode 14, block #0, offset 0: directory has no checksum.
 Fix? yes
 
-Directory inode 14, block #0, offset 12: directory passes checks but fails checksum.
-Fix? yes
-
 Directory inode 15, block #0, offset 0: directory has no checksum.
 Fix? yes