• NeilBrown's avatar
    md: fix two bugs when attempting to resize RAID0 array. · 84453f1a
    NeilBrown authored
    commit a6468539 upstream.
    
    You cannot resize a RAID0 array (in terms of making the devices
    bigger), but the code doesn't entirely stop you.
    So:
    
     disable setting of the available size on each device for
     RAID0 and Linear devices.  This must not change as doing so
     can change the effective layout of data.
    
     Make sure that the size that raid0_size() reports is accurate,
     but rounding devices sizes to chunk sizes.  As the device sizes
     cannot change now, this isn't so important, but it is best to be
     safe.
    
    Without this change:
      mdadm --grow /dev/md0 -z max
      mdadm --grow /dev/md0 -Z max
      then read to the end of the array
    
    can cause a BUG in a RAID0 array.
    
    These bugs have been present ever since it became possible
    to resize any device, which is a long time.  So the fix is
    suitable for any -stable kerenl.
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    [bwh: Backported to 3.2: adjust context]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    84453f1a
md.c 214 KB