• NeilBrown's avatar
    Fix problem with waiting while holding rcu read lock in md/bitmap.c · b2d2c4ce
    NeilBrown authored
    A recent patch to protect the rdev list with rcu locking leaves us
    with a problem because we can sleep on memalloc while holding the
    rcu lock.
    
    The rcu lock is only needed while walking the linked list as
    uninteresting devices (failed or spares) can be removed at any time.
    
    So only take the rcu lock while actually walking the linked list.
    Take a refcount on the rdev during the time when we drop the lock
    and do the memalloc to start IO.
    When we return to the locked code, all the interesting devices
    on the list will not have moved, so we can simply use
    list_for_each_continue_rcu to pick up where we left off.
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    b2d2c4ce
bitmap.c 42.9 KB