• NeilBrown's avatar
    md: allow metadata update while suspending. · 35bfc521
    NeilBrown authored
    There are various deadlocks that can occur
    when a thread holds reconfig_mutex and calls
    ->quiesce(mddev, 1).
    As some write request block waiting for
    metadata to be updated (e.g. to record device
    failure), and as the md thread updates the metadata
    while the reconfig mutex is held, holding the mutex
    can stop write requests completing, and this prevents
    ->quiesce(mddev, 1) from completing.
    
    ->quiesce() is now usually called from mddev_suspend(),
    and it is always called with reconfig_mutex held.  So
    at this time it is safe for the thread to update metadata
    without explicitly taking the lock.
    
    So add 2 new flags, one which says the unlocked updates is
    allowed, and one which ways it is happening.  Then allow it
    while the quiesce completes, and then wait for it to finish.
    Reported-and-tested-by: default avatarXiao Ni <xni@redhat.com>
    Signed-off-by: default avatarNeilBrown <neilb@suse.com>
    Signed-off-by: default avatarShaohua Li <shli@fb.com>
    35bfc521
md.h 25.5 KB