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 <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Darrick J. Wong 2014-12-13 21:55:12 -05:00 committed by Theodore Ts'o
parent 492084ffb2
commit d02d019557
2 changed files with 8 additions and 9 deletions

View 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 */

View 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