In ddsnapd.c, we calculate each commit block's checksum and record it to
detect journal corruption. But the current code uses only the first
sb->metadata.asi->allocsize_bits bytes instead of the whole block. So it
won't detect any corruption happened at other place in a commit block. We
also got ""corrupt journal block"" error during replay_journal when using a
small chunk size (e.g., 512) because the recorded checksum is outside of
sb->metadata.asi->allocsize_bits bytes.
Here is the proposed fix.
@@ -404,7 +423,7 @@ static int is_commit_block(struct commit
static u32 checksum_block(struct superblock *sb, u32 *data)
{
int i, sum = 0;
- for (i = 0; i < sb->metadata.asi->allocsize_bits >> 2; i++)
+ for (i = 0; i < 1 << (sb->metadata.asi->allocsize_bits - 2); i++)
sum += data[i];
return sum;
}
Jiaying
Original issue reported on code.google.com by jiahotc...@gmail.com on 11 Jul 2008 at 12:29
Original issue reported on code.google.com by
jiahotc...@gmail.com
on 11 Jul 2008 at 12:29