From: Shaohua Li <shli@xxxxxx> The raid5-cache .quiesce assumes it's called with reconfig_mutex hold. It's true at most time but there are some exceptions. Since raid5-cache .quiesce could write superblock, it must be called with reconfig_mutex hold. We already have facility in .quiesce to indicate if it's called with the mutex hold. This patch makes raid5-cache .quiesce use the facility. Signed-off-by: Shaohua Li <shli@xxxxxx> --- drivers/md/raid5-cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 551158c..e4070d2 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -97,6 +97,7 @@ struct r5l_log { bool need_cache_flush; bool in_teardown; + bool reconfig_mutex_locked; }; /* @@ -712,7 +713,7 @@ static void r5l_write_super_and_discard_space(struct r5l_log *log, * md_check_recovery() fails, so the PENDING never get cleared. The * in_teardown check workaround this issue. */ - if (!log->in_teardown) { + if (!log->in_teardown || !log->reconfig_mutex_locked) { set_mask_bits(&mddev->flags, 0, BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); md_wakeup_thread(mddev->thread); @@ -826,6 +827,7 @@ void r5l_quiesce(struct r5l_log *log, int state, bool reconfig_mutex_locked) struct mddev *mddev; if (!log || state == 2) return; + log->reconfig_mutex_locked = reconfig_mutex_locked; if (state == 0) { log->in_teardown = 0; /* @@ -850,6 +852,7 @@ void r5l_quiesce(struct r5l_log *log, int state, bool reconfig_mutex_locked) md_unregister_thread(&log->reclaim_thread); r5l_do_reclaim(log); } + log->reconfig_mutex_locked = false; } bool r5l_log_disk_error(struct r5conf *conf) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html