shithub: lwext4

Download patch

ref: ad1f9bd09fc8293514646eed78f5a0e10ec9c742
parent: cc9f824615037c65f4b6b47ee50e9e77b3d8e6e1
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Fri Oct 23 20:09:09 EDT 2015

METADATA_CSUM: ext4_extent_full.c: do checksum on all extent tree blocks.

--- a/lwext4/ext4_extent_full.c
+++ b/lwext4/ext4_extent_full.c
@@ -783,6 +783,7 @@
 		spt->ptr = 0;
 	} else if (bh.lb_id) {
 		/* If we got a sibling leaf. */
+		ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&bh));
 		bh.dirty = true;
 
 		spt->path.p_block = ext4_idx_pblock(ix);
@@ -1054,6 +1055,7 @@
 		spt->ptr = 0;
 	} else if (bh.lb_id) {
 		/* If we got a sibling leaf. */
+		ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&bh));
 		bh.dirty = true;
 
 		spt->path.p_block = ext4_ext_pblock(ex);
@@ -1135,7 +1137,6 @@
 		    to_le16(ext4_ext_space_block(inode_ref));
 
 	neh->magic = to_le16(EXT4_EXTENT_MAGIC);
-	ext4_extent_block_csum_set(inode_ref, neh);
 
 	/* Update top-level index: num,max,pointer */
 	neh = ext_inode_hdr(inode_ref->inode);
@@ -1150,6 +1151,7 @@
 	}
 	neh->depth = to_le16(to_le16(neh->depth) + 1);
 
+	ext4_extent_block_csum_set(inode_ref, neh);
 	bh.dirty = true;
 	inode_ref->dirty = true;
 	ext4_block_set(inode_ref->fs->bdev, &bh);