From: Theodore Ts'o Date: Tue, 11 May 2010 19:12:52 +0000 (-0400) Subject: e2fsck: Don't clear inodes if we found inodes that are in the unused region X-Git-Tag: v1.41.12~21 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=0433c1f1b72bb85d9ea11e7716a415a878a655c8;p=tools%2Fe2fsprogs.git e2fsck: Don't clear inodes if we found inodes that are in the unused region Commit 6267ee4 avoided repeating pass #1 over and over again if multiple block groups are found with inodes in the bg_itable_unused region during pass #2. This caused a regression because the problem with not restarting pass #1 right away is that e2fsck will offer to clear directory entries for inodes that are deleted, and e2fsck can't easily distinguish between deleted inodes and inodes that were skipped because of an incorrect bg_itable_unused value. So once an inode is found in an unused region and we know that we're going to restart the e2fsck pass, don't offer to clear any deleted inodes --- since those will be caught in the second round. Addresses-Google-Bug: #2642165 Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index 761c2f1..2847901 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1007,13 +1007,18 @@ out_htree: } } - if (!(ext2fs_test_inode_bitmap(ctx->inode_used_map, - dirent->inode))) { - /* - * If the inode is unused, offer to clear it. - */ + /* + * Offer to clear unused inodes; if we are going to be + * restarting the scan due to bg_itable_unused being + * wrong, then don't clear any inodes to avoid zapping + * inodes that were skipped during pass1 due to an + * incorrect bg_itable_unused; we'll get any real + * problems after we restart. + */ + if (!(ctx->flags & E2F_FLAG_RESTART_LATER) && + !(ext2fs_test_inode_bitmap(ctx->inode_used_map, + dirent->inode))) problem = PR_2_UNUSED_INODE; - } if (problem) { if (fix_problem(ctx, problem, &cd->pctx)) {