• Neil Brown's avatar
    [PATCH] md: fix problems with checksum handling in MD superblocks. · e50873c0
    Neil Brown authored
    md currently uses csum_partial to calculate checksums for superblocks.
    However this function is not consistent across all architectures.  Some
    (i386) to a 32bit csum.  Some (alpha) do a 16 bit csum.  This makes it hard
    for userspace to keep up.
    
    So we provide a generic routine (that does exactly what the i386
    csum_partial does) and:
    
    - When setting the csum, use csum_partial so that old kernels will still
      recognise the superblock
    
    - When checking the csum, allow either csum_partial or the new generic
      code to provide the right csum.  This allows user-space to just use the
      common code and always work.
    
    Also modify the csum for version-1 superblock (which currently aren't being
    used) to always user a predictable checksum algorithm.
    
    Thanks to Mike Tran <mhtran@us.ibm.com> for noticing this.
    Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    e50873c0
md.c 88 KB