diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6c724fde5fd8..fea67727f807 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5413,6 +5413,9 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len) old_groups = conf->worker_groups; old_group_cnt = conf->worker_cnt_per_group; + if (old_groups) + flush_workqueue(raid5_wq); + conf->worker_groups = NULL; err = alloc_thread_groups(conf, new); if (err) {