summaryrefslogtreecommitdiff
path: root/misc/dumpe2fs.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-09-08 16:11:43 -0700
committerTheodore Ts'o <tytso@mit.edu>2014-09-11 12:40:54 -0400
commit38d5adf33993264d8db78ebb3d924e9d9e155590 (patch)
treec8518731a667f9852f9b07bce49d2143a197ff31 /misc/dumpe2fs.c
parent330cebc0e95aa8d81477a63932381bcc84eea3c1 (diff)
downloade2fsprogs-38d5adf33993264d8db78ebb3d924e9d9e155590.tar.gz
e2fsck/debugfs: fix descriptor block size handling errors with journal_csum
It turns out that there are some serious problems with the on-disk format of journal checksum v2. The foremost is that the function to calculate descriptor tag size returns sizes that are too big. This causes alignment issues on some architectures and is compounded by the fact that some parts of jbd2 use the structure size (incorrectly) to determine the presence of a 64bit journal instead of checking the feature flags. These errors regrettably lead to the journal corruption reported by Mr. Reardon. Therefore, introduce journal checksum v3, which enlarges the descriptor block tag format to allow for full 32-bit checksums of journal blocks, fix the journal tag function to return the correct sizes, and fix the jbd2 recovery code to use feature flags to determine 64bitness. Add a few function helpers so we don't have to open-code quite so many pieces. Switching to a 16-byte block size was found to increase journal size overhead by a maximum of 0.1%, to convert a 32-bit journal with no checksumming to a 32-bit journal with checksum v3 enabled. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reported-by: TR Reardon <thomas_reardon@hotmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/dumpe2fs.c')
-rw-r--r--misc/dumpe2fs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index a1c5ba26..25dce9c5 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -415,8 +415,10 @@ static void print_inline_journal_information(ext2_filsys fs)
if (jsb->s_feature_compat &
ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_CHECKSUM))
printf("%s", _("Journal checksum type: crc32\n"));
- if (jsb->s_feature_incompat &
- ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2))
+ if ((jsb->s_feature_incompat &
+ ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V3)) ||
+ (jsb->s_feature_incompat &
+ ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2)))
printf(_("Journal checksum type: %s\n"
"Journal checksum: 0x%08x\n"),
journal_checksum_type_str(jsb->s_checksum_type),
@@ -454,8 +456,10 @@ static void print_journal_information(ext2_filsys fs)
if (jsb->s_feature_compat &
ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_CHECKSUM))
printf("%s", _("Journal checksum type: crc32\n"));
- if (jsb->s_feature_incompat &
- ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2))
+ if ((jsb->s_feature_incompat &
+ ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V3)) ||
+ (jsb->s_feature_incompat &
+ ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_CSUM_V2)))
printf(_("Journal checksum type: %s\n"
"Journal checksum: 0x%08x\n"),
journal_checksum_type_str(jsb->s_checksum_type),