From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 07/19] e2fsck: try to salvage corrupt directory entry blocks
Date: Fri, 01 Aug 2014 11:12:28 -0700 [thread overview]
Message-ID: <20140801181228.12496.58789.stgit@birch.djwong.org> (raw)
In-Reply-To: <20140801181139.12496.14390.stgit@birch.djwong.org>
From: Darrick J. Wong <darrick.wong@oracle.com>
Remove the code that would prompt the user to zap directory entry
blocks with bad checksums (i.e. strict_csums). Instead, we'll run the
directory entries through the usual repair routines in an attempt to
save whatever we can. At the same time, refactor the code that
schedules the repair of missing dirblock checksum entries.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
e2fsck/pass2.c | 34 +++++++++-------------------------
e2fsck/problem.c | 5 -----
e2fsck/problem.h | 3 ---
3 files changed, 9 insertions(+), 33 deletions(-)
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 69ebab6..ae7768f 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -944,32 +944,16 @@ static int check_dir_block(ext2_filsys fs,
out_htree:
#endif /* ENABLE_HTREE */
- /* Verify checksum. */
- if (is_leaf && de_csum_size && !inline_data_size) {
- /* No space for csum? Rebuild dirs in pass 3A. */
- if (!ext2fs_dirent_has_tail(fs, (struct ext2_dir_entry *)buf)) {
- de_csum_size = 0;
- if (e2fsck_dir_will_be_rehashed(ctx, ino))
- 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);
+ /* Leaf node with no space for csum? Rebuild dirs in pass 3A. */
+ 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,
+ &cd->pctx))
goto skip_checksum;
- }
- if (failed_csum) {
- char *buf2;
- if (!fix_problem(cd->ctx, PR_2_LEAF_NODE_CSUM_INVALID,
- &cd->pctx))
- goto skip_checksum;
- ext2fs_new_dir_block(fs,
- db->blockcnt == 0 ? ino : 0,
- EXT2_ROOT_INO, &buf2);
- memcpy(buf, buf2, fs->blocksize);
- ext2fs_free_mem(&buf2);
- dir_modified++;
- failed_csum = 0;
- }
+ e2fsck_rehash_dir_later(ctx, ino);
+ goto skip_checksum;
}
/* htree nodes don't use fake dirents to store checksums */
if (!is_leaf)
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 1b6bdb0..80ca3a0 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1477,11 +1477,6 @@ static struct e2fsck_problem problem_table[] = {
N_("@p @h %d: internal node fails checksum.\n"),
PROMPT_CLEAR_HTREE, PR_PREEN_OK },
- /* leaf node fails checksum */
- { PR_2_LEAF_NODE_CSUM_INVALID,
- N_("@d @i %i, %B, offset %N: @d fails checksum.\n"),
- PROMPT_SALVAGE, PR_PREEN_OK },
-
/* leaf node has no checksum */
{ PR_2_LEAF_NODE_MISSING_CSUM,
N_("@d @i %i, %B, offset %N: @d has no checksum.\n"),
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 89db5f3..4813fc6 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -879,9 +879,6 @@ struct problem_context {
/* htree node fails checksum */
#define PR_2_HTREE_NODE_CSUM_INVALID 0x02004A
-/* dir leaf node fails checksum */
-#define PR_2_LEAF_NODE_CSUM_INVALID 0x02004B
next prev parent reply other threads:[~2014-08-01 18:12 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 18:11 [PATCH 00/19] e2fsprogs patchbomb 7/14, part 2.1 Darrick J. Wong
2014-08-01 18:11 ` [PATCH 01/19] e2fuzz: fix fs handle cleanup when closing fails Darrick J. Wong
2014-08-03 2:22 ` Theodore Ts'o
2014-08-01 18:11 ` [PATCH 02/19] e2fsck: never free critical metadata blocks in the block found map Darrick J. Wong
2014-08-03 2:22 ` Theodore Ts'o
2014-08-01 18:11 ` [PATCH 03/19] e2fsck: use root dir for lost+found when really desperate Darrick J. Wong
2014-08-03 2:25 ` Theodore Ts'o
2014-08-05 0:58 ` Darrick J. Wong
2014-08-05 2:06 ` Theodore Ts'o
2014-08-01 18:12 ` [PATCH 04/19] dumpe2fs: complain when checksum verification fails Darrick J. Wong
2014-08-03 2:26 ` Theodore Ts'o
2014-08-01 18:12 ` [PATCH 05/19] libext2fs: check EA block headers when reading in the block Darrick J. Wong
2014-08-03 2:33 ` Theodore Ts'o
2014-08-01 18:12 ` [PATCH 06/19] e2fsck: try to salvage extent blocks with bad checksums Darrick J. Wong
2014-08-03 2:33 ` Theodore Ts'o
2014-08-01 18:12 ` Darrick J. Wong [this message]
2014-08-03 2:33 ` [PATCH 07/19] e2fsck: try to salvage corrupt directory entry blocks Theodore Ts'o
2014-08-01 18:12 ` [PATCH 08/19] e2fsck: offer to clear inode table blocks that are insane Darrick J. Wong
2014-08-03 2:46 ` Theodore Ts'o
2014-08-01 18:12 ` [PATCH 09/19] e2fsck: correctly preserve fs flags when modifying ignore-csum-error flag Darrick J. Wong
2014-08-03 2:48 ` Theodore Ts'o
2014-08-01 18:12 ` [PATCH 10/19] libext2fs: Don't cache inodes that fail checksum verification Darrick J. Wong
2014-08-03 2:50 ` Theodore Ts'o
2014-08-01 18:12 ` [PATCH 11/19] e2fsck: disable checksum verification in a few select places Darrick J. Wong
2014-08-03 2:51 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 12/19] e2fsck: always ask to fix an inode that fails checksum verification Darrick J. Wong
2014-08-03 2:55 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 13/19] tests: add regression tests for EA blocks with bad checksums Darrick J. Wong
2014-08-03 3:42 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 14/19] tests: add tests for handling of corrupt extents Darrick J. Wong
2014-08-03 3:47 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 15/19] tests: add tests for directory entry blocks with checksum errors Darrick J. Wong
2014-08-03 3:49 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 16/19] tests: add regression tests for MMP blocks with bad checksums Darrick J. Wong
2014-08-03 3:49 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 17/19] tests: add regression tests for superblocks " Darrick J. Wong
2014-08-03 3:50 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 18/19] tests: add regression tests for group descriptors " Darrick J. Wong
2014-08-03 3:51 ` Theodore Ts'o
2014-08-01 18:13 ` [PATCH 19/19] tests: add regression tests for inodes " Darrick J. Wong
2014-08-03 3:52 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140801181228.12496.58789.stgit@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).