• NeilBrown's avatar
    md/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants. · 8a60f63d
    NeilBrown authored
    commit 108cef3a upstream.
    
    It is critical that fetch_block() and handle_stripe_dirtying()
    are consistent in their analysis of what needs to be loaded.
    Otherwise raid5 can wait forever for a block that won't be loaded.
    
    Currently when writing to a RAID5 that is resyncing, to a location
    beyond the resync offset, handle_stripe_dirtying chooses a
    reconstruct-write cycle, but fetch_block() assumes a
    read-modify-write, and a lockup can happen.
    
    So treat that case just like RAID6, just as we do in
    handle_stripe_dirtying.  RAID6 always does reconstruct-write.
    
    This bug was introduced when the behaviour of handle_stripe_dirtying
    was changed in 3.7, so the patch is suitable for any kernel since,
    though it will need careful merging for some versions.
    
    Fixes: a7854487Reported-by: default avatarHenry Cai <henryplusplus@gmail.com>
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    8a60f63d
raid5.c 200 KB