From: Darrick J. Wong Date: Sun, 14 Dec 2014 02:55:12 +0000 (-0500) Subject: e2fsck: only complain about no-checksum directory blocks once X-Git-Tag: v1.43-WIP-2015-05-18~115 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d02d019557d993c8dfe2f7d0fea841101f0d9e61;hp=492084ffb245dd027a761914574871913862a78a;p=tools%2Fe2fsprogs.git e2fsck: only complain about no-checksum directory blocks once 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 Signed-off-by: Theodore Ts'o --- diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index cd0762a..7aaebce 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -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 */ diff --git a/tests/f_dir_bad_csum/expect.1 b/tests/f_dir_bad_csum/expect.1 index bbcbfcb..b2b2fae 100644 --- a/tests/f_dir_bad_csum/expect.1 +++ b/tests/f_dir_bad_csum/expect.1 @@ -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