• Y
    md: add a mutex to synchronize idle and frozen in action_store() · 1c617ac5
    Yu Kuai 提交于
    hulk inclusion
    category: bugfix
    bugzilla: https://gitee.com/openeuler/kernel/issues/I6OMCC
    CVE: NA
    
    --------------------------------
    
    Currently, for idle and frozen, action_store will hold 'reconfig_mutex'
    and call md_reap_sync_thread() to stop sync thread, however, this will
    cause deadlock (explained in the next patch). In order to fix the
    problem, following patch will release 'reconfig_mutex' and wait on
    'resync_wait', like md_set_readonly() and do_md_stop() does.
    
    Consider that action_store() will set/clear 'MD_RECOVERY_FROZEN'
    unconditionally, which might cause unexpected problems, for example,
    frozen just set 'MD_RECOVERY_FROZEN' and is still in progress, while
    'idle' clear 'MD_RECOVERY_FROZEN' and new sync thread is started, which
    might starve in progress frozen.
    
    This patch add a mutex to synchronize idle and frozen from
    action_store().
    Signed-off-by: NYu Kuai <yukuai3@huawei.com>
    Reviewed-by: NHou Tao <houtao1@huawei.com>
    Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
    1c617ac5
md.h 28.6 KB