ref: b4f36a128a7826b7343c8181b1ab34fe48ebfc18
parent: c261c575aa8026aa4942cfabd5b61788b80b8ebb
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sat Jan 2 05:50:47 EST 2016
ext4_journal: fix transaction sequence not being checksummed.
--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -291,7 +291,8 @@
* JBD_FEATURE_COMPAT_CHECKSUM is enabled.
*/
static uint32_t jbd_block_csum(struct jbd_fs *jbd_fs, const void *buf,
- uint32_t csum)
+ uint32_t csum,
+ uint32_t sequence)
{
uint32_t checksum = 0;
@@ -300,6 +301,9 @@
/* First calculate crc32c checksum against fs uuid */
checksum = ext4_crc32c(EXT4_CRC32_INIT, jbd_fs->sb.uuid,
sizeof(jbd_fs->sb.uuid));
+ /* Then calculate crc32c checksum against sequence no. */
+ checksum = ext4_crc32c(checksum, &sequence,
+ sizeof(uint32_t));
/* Calculate crc32c checksum against tho whole block */
checksum = ext4_crc32c(checksum, buf,
block_size);
@@ -1697,7 +1701,8 @@
}
checksum = jbd_block_csum(journal->jbd_fs,
jbd_buf->block.data,
- checksum);
+ checksum,
+ trans->trans_id);
again:
if (!desc_iblock) {
struct jbd_bhdr *bhdr;