From 14fd8584fd527578149cc1da5d8aef002c69dc5f Mon Sep 17 00:00:00 2001 Date: Sat, 6 Mar 2010 02:30:02 +0000 Subject: [RHEL5.7 PATCH 6/8] dm mpath: hold io until all pg_inits completed BZ 673058 Upstream commit d0259bf0eefc503d3c9c9ccda35033c3dd3aac30 Author: Kiyoshi Ueda Date: Sat Mar 6 02:30:02 2010 +0000 dm mpath: hold io until all pg_inits completed m->queue_io is set to block processing I/Os, and it needs to be kept while pg-init, which issues multiple path activations, is in progress. But m->queue is cleared when a path activation completes without error in pg_init_done(), even while other path activations are in progress. That may cause undesired -EIO on paths which are not complete activation. This patch fixes that by not clearing m->queue_io until all path activations complete. (Before the hardware handlers were moved into the SCSI layer, pg_init only used one path.) Signed-off-by: Kiyoshi Ueda Signed-off-by: Jun'ichi Nomura Signed-off-by: Alasdair G Kergon --- drivers/md/dm-mpath.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 4de9a33..b8adff1 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1243,16 +1243,20 @@ static void pg_init_done(void *data, int errors) m->current_pgpath = NULL; m->current_pg = NULL; } - } else if (!m->pg_init_required) { - m->queue_io = 0; + } else if (!m->pg_init_required) pg->bypassed = 0; - } - m->pg_init_in_progress--; - if (!m->pg_init_in_progress) { - m->pg_init_delay = delay; - queue_work(kmultipathd, &m->process_queued_ios); - } + if (--m->pg_init_in_progress) + /* Activations of other paths are still on going */ + goto out; + + if (!m->pg_init_required) + m->queue_io = 0; + + m->pg_init_delay = delay; + queue_work(kmultipathd, &m->process_queued_ios); + +out: spin_unlock_irqrestore(&m->lock, flags); } -- 1.7.3.4