• Neil Brown's avatar
    [PATCH] md: Fix bug in raid5 · a531b8fc
    Neil Brown authored
    When analysing a stripe in handle_stripe we set bits
     R5_Wantread or R5_Wantwrite
    to indicate if a read or write is needed.  We don't actually schedule the
    IO immediately as this is done under a spinlock (sh->lock) and
    generic_make_request can block.  Instead we check these bits after
    the lock has been lifted and then schedule the IO.
    
    But once the lock has been lifted we aren't safe against multiple
    access, and it is possible that the IO will be scheduled never, or twice.
    
    So, we use test_and_clear to check and potentially schedule the IO.
    
    This wasn't a problem in 2.4 because the equivalent information was
    stored on the stack instead of in the stripe.
    
    We also make sure bi_io_vec[0] has correct values as a previous
    call to generic_make_request may have changed them.
    a531b8fc
raid5.c 45 KB