On Thu, Sep 01, 2011 at 01:42:26AM -0600, Andreas Dilger wrote:
On 2011-08-31, at 6:32 PM, Darrick J. Wong wrote:
quoted
Calculate and verify the checksums of extended attribute blocks. This only
applies to separate EA blocks that are pointed to by inode->i_file_acl (i.e.
external EA blocks); the checksum lives in the EA header.
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 25b7387..b2b20af 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -27,7 +27,8 @@ struct ext4_xattr_header { __le32 h_refcount; /* reference count */
__le32 h_blocks; /* number of disk blocks used */
__le32 h_hash; /* hash value of all attributes */
- __u32 h_reserved[4]; /* zero right now */
+ __le32 h_checksum; /* crc32c(uuid+inum+xattrblock) */
This comment is incorrect - the inum cannot be part of the checksum if
the block is shared. That said, I wouldn't object if the checksum DID
include the inum if the block was not shared (h_refcount == 1). Since
the h_refcount needs to be modified and the checksum recomputed if other
inodes share this block, this doesn't impose any extra overhead.
Oops, I guess I was typing too fast. "inum" should be "ea_block_num". Though
I suspect that in the common case files don't share EA blocks, so we could do
inum when refcount==1.
--D
Cheers, Andreas