Re: [PATCH 06/22] ext4: Calculate and verify inode checksums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 05, 2011 at 11:24:06AM -0500, Ted Ts'o wrote:
> On Mon, Nov 28, 2011 at 03:26:56PM -0800, Darrick J. Wong wrote:
> > +	/* Precompute second piece of csum */
> > +	if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
> > +			EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
> > +		__u32 csum;
> > +		struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
> > +		__le32 inum = cpu_to_le32(inode->i_ino);
> > +		__le32 gen = cpu_to_le32(inode->i_generation);
> > +		csum = ext4_chksum(sbi, sbi->s_uuid_csum, (__u8 *)&inum,
> > +				   sizeof(inum));
> > +		ei->i_uuid_inum_csum = ext4_chksum(sbi, csum, (__u8 *)&gen,
> > +						   sizeof(gen));
> > +	}
> 
> Why do we include a copy of i_generation in the precomputed initial
> part of the checksum?  Since i_generation is in the raw, on-disk
> version of the inode, what's the rationale for including it here?  It
> shouldn't *hurt*, but it a few extra CPU cycles, and I'm not seeing
> how it helps.

i_uuid_inum_csum seeds crc32c for all the metadata objects that are attached to
an inode (extents, dir blocks, xattrs), not just the inode itself.  That way
you can ensure that a piece of metadata corresponds to a specific incarnation
of an inode, not just any of the inode's incarnations since mkfs time.

--D
> 
> 						- Ted
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux