e2fsck: check htree leaf block checksums
PATCH 1/1 e2fsck: check htree leaf block checksums
We weren't verifying the checksum of an htree leaf block due to a coding error that marked all htree blocks as not having checksums. While we're at it, fix the error message that gets displayed so that it doesn't print a meaningless block offset.
Signed-off-by Darrick J. Wong <[email protected]>
--- e2fsck/pass2.c | 2 +- e2fsck/problem.c | 2 +- tests/f_dir_bad_csum/expect.1 | 2 +- tests/f_htree_leaf_csum/expect.1 | 12 ++++++++++++ tests/f_htree_leaf_csum/expect.2 | 7 +++++++ tests/f_htree_leaf_csum/image.gz | Bin tests/f_htree_leaf_csum/name | 1 + 7 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tests/f_htree_leaf_csum/expect.1 create mode 100644 tests/f_htree_leaf_csum/expect.2 create mode 100644 tests/f_htree_leaf_csum/image.gz create mode 100644 tests/f_htree_leaf_csum/name
e2fsck/pass2.c +1 -1
@@ -1085,7 +1085,7 @@ inline_read_fail: ((fs->blocksize - (8 + dx_csum_size)) / sizeof(struct ext2_dx_entry)))) dx_db->type = DX_DIRBLOCK_NODE; - is_leaf =0 ; + is_leaf = (dx_db->type ==DX_DIRBLOCK_LEAF ); } out_htree:#endif /* ENABLE_HTREE */
e2fsck/problem.c +1 -1
@@ -1597,7 +1597,7 @@ static struct e2fsck_problem problem_table[] = {/* leaf node passes checks but fails checksum */ {PR_2_LEAF_NODE_ONLY_CSUM_INVALID , -N_ ("@d @i %i, %B, offset %N: @d passes checks but fails checksum.\n" ), +N_ ("@d @i %i, %B: @d passes checks but fails checksum.\n" ), PROMPT_FIX, PR_PREEN_OK },/* inline directory inode size must be a multiple of 4 */
tests/f_dir_bad_csum/expect.1 +1 -1
@@ -1,6 +1,6 @@ Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure -Directory inode 12, block #0, offset 12: directory passes checks but fails checksum. +Directory inode 12, block #0: directory passes checks but fails checksum. Fix? yes Directory inode 13, block #0, offset 0: directory has no checksum.
tests/f_htree_leaf_csum/expect.1 new file +12 -0
@@ -0,0 +1,12 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Directory inode 12, block #1: directory passes checks but fails checksum. +Fix? yes + +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information + +test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** +test_filesys: 430/512 files (0.2% non-contiguous), 45/512 blocks +Exit status is 1
tests/f_htree_leaf_csum/expect.2 new file +7 -0
@@ -0,0 +1,7 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 430/512 files (0.2% non-contiguous), 45/512 blocks +Exit status is 0
tests/f_htree_leaf_csum/image.gz new file binary +0 -0
tests/f_htree_leaf_csum/name new file +1 -0
@@ -0,0 +1 @@ +bad csum in htree leaf block
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
Theodore Ts'o
AppliedQuoted 6 lines · Darrick J. Wong
We weren't verifying the checksum of an htree leaf block due to a coding error that marked all htree blocks as not having checksums. While we're at it, fix the error message that gets displayed so that it doesn't print a meaningless block offset.
Signed-off-by Darrick J. Wong <[email protected]>
Thanks, applied.
- Ted