• Heinz Mauelshagen's avatar
    dm raid: fix stripes adding reshape size issues · d176fadb
    Heinz Mauelshagen authored
    Adding stripes to an existing raid4/5/6/10 mapped device grows its
    capacity though it'll be only made available _after_ the respective
    reshape finished as of MD kernel reshape semantics.  Such reshaping
    involves moving a window forward starting at BOD reading content
    from previous lesser stripes and writing them back in the new
    layout with more stripes.  Once that process finishes at end of
    previous data, the grown size may be announced and used.  In order
    to avoid writing over any existing data in place, out-of-place space
    is added to the beginning of each data device by lvm2 before starting
    the reshape process. That reshape space wasn't taken into acount for
    data device size calculation.
    
    Fixes resulting from above:
    
    - correct event handling conditions in do_table_event() to set
      the device's capacity after the stripe adding reshape ended
    
    - subtract mentioned out-of-place space doing data device and
      array size calculations
    
    - conditionally set capacity as of superblock in preresume
    
    Testing:
    
    - passes all LVM2 RAID tests including new lvconvert-raid-reshape-size.sh one
    Tested-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
    Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    d176fadb
dm-raid.c 120 KB