The workqueue are shared by many multipath devices, we just need to flush
whole workqueue when it is necessary. Otherwise, we just flush works.

Signed-off-by: wuzhouhui <[email protected]>
---
 drivers/md/dm-mpath.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index f7810cc..0f14732 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1154,9 +1154,10 @@ static void flush_multipath_work(struct multipath *m)
        set_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
        smp_mb__after_atomic();
 
-       flush_workqueue(kmpath_handlerd);
+       if (atomic_read(&m->pg_init_in_progress))
+               flush_workqueue(kmpath_handlerd);
        multipath_wait_for_pg_init_completion(m);
-       flush_workqueue(kmultipathd);
+       flush_work(&m->process_queued_bios);
        flush_work(&m->trigger_event);
 
        clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
-- 
1.9.1

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to