From: Chandra Seetharaman <sekharan@us.ibm.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Alasdair G Kergon <agk@redhat.com>,
Hannes Reinecke <hare@suse.de>,
Mike Christie <mchristi@redhat.com>,
Mike Anderson <andmike@us.ibm.com>
Subject: [RFC][PATCH] Handle multipath paths in a path group properly during pg_init (was "RE: [dm-devel] DM does not activate the paths if there are more than one path in path group during failover")
Date: Thu, 13 Nov 2008 15:48:58 -0800 [thread overview]
Message-ID: <1226620138.8998.64.camel@chandra-ubuntu> (raw)
In-Reply-To: <E463DF2B2E584B4A82673F53D62C2EF45BE75B7F@cosmail01.lsi.com>
The problem reported by Moger Babu was caused due to the architectural
change made when we moved from dm hardware handler to SCSI hardware
handler.
Thanks Babu for finding and reporting the bug.
All of the hardware handlers, do have a state now, and they are set to
active and (some form of) inactive. All of them have prep_fn, which use
this "state" to fail the I/O without it ever being sent to the device.
As Babu has noted in his email, the pg_init/activate is sent on only one
path and the "state" of that path is changed appropriately to "active"
while other paths in the same path group are never changed as they never
got an "activate".
Attached is a patch (compiled, tested, but not clean yet), which makes
changes in the dm-multipath layer to send an "activate" on each paths in
the path groups.
Mike (Anderson) and I had a discussion about whether to implement this
in the dm-mulitpath layer or in the SCSI hardware handler layer and we
came to a conclusion that it is best suited to be in the dm-mulitpath
layer as it is the one that knows the relationship between different
paths.
If it were to be done at the Hardware handler layer, then the hardware
handler may end up having a different notion of the path relationship
and hence may not work as expected by the dm-multipath layer.
Please provide your feedback on this approach and any additional
comments.
----------
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
Index: linux-2.6.28-rc3/drivers/md/dm-mpath.c
===================================================================
--- linux-2.6.28-rc3.orig/drivers/md/dm-mpath.c
+++ linux-2.6.28-rc3/drivers/md/dm-mpath.c
@@ -36,6 +36,7 @@ struct pgpath {
struct dm_path path;
struct work_struct deactivate_path;
+ struct work_struct activate_path;
};
#define path_to_pgpath(__pgp) container_of((__pgp), struct pgpath, path)
@@ -65,8 +66,6 @@ struct multipath {
spinlock_t lock;
const char *hw_handler_name;
- struct work_struct activate_path;
- struct pgpath *pgpath_to_activate;
unsigned nr_priority_groups;
struct list_head priority_groups;
unsigned pg_init_required; /* pg_init needs calling? */
@@ -129,6 +128,7 @@ static struct pgpath *alloc_pgpath(void)
if (pgpath) {
pgpath->is_active = 1;
INIT_WORK(&pgpath->deactivate_path, deactivate_path);
+ INIT_WORK(&pgpath->activate_path, activate_path);
}
return pgpath;
@@ -170,10 +170,6 @@ static void free_pgpaths(struct list_hea
if (m->hw_handler_name)
scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev));
dm_put_device(ti, pgpath->path.dev);
- spin_lock_irqsave(&m->lock, flags);
- if (m->pgpath_to_activate == pgpath)
- m->pgpath_to_activate = NULL;
- spin_unlock_irqrestore(&m->lock, flags);
free_pgpath(pgpath);
}
}
@@ -203,7 +199,6 @@ static struct multipath *alloc_multipath
m->queue_io = 1;
INIT_WORK(&m->process_queued_ios, process_queued_ios);
INIT_WORK(&m->trigger_event, trigger_event);
- INIT_WORK(&m->activate_path, activate_path);
m->mpio_pool = mempool_create_slab_pool(MIN_IOS, _mpio_cache);
if (!m->mpio_pool) {
kfree(m);
@@ -428,8 +423,8 @@ static void process_queued_ios(struct wo
{
struct multipath *m =
container_of(work, struct multipath, process_queued_ios);
- struct pgpath *pgpath = NULL;
- unsigned init_required = 0, must_queue = 1;
+ struct pgpath *pgpath = NULL, *tmp;
+ unsigned must_queue = 1;
unsigned long flags;
spin_lock_irqsave(&m->lock, flags);
@@ -447,19 +442,15 @@ static void process_queued_ios(struct wo
must_queue = 0;
if (m->pg_init_required && !m->pg_init_in_progress && pgpath) {
- m->pgpath_to_activate = pgpath;
m->pg_init_count++;
m->pg_init_required = 0;
- m->pg_init_in_progress = 1;
- init_required = 1;
+ list_for_each_entry(tmp, &pgpath->pg->pgpaths, list) {
+ queue_work(kmpath_handlerd, &tmp->activate_path);
+ m->pg_init_in_progress++;
+ }
}
-
out:
spin_unlock_irqrestore(&m->lock, flags);
-
- if (init_required)
- queue_work(kmpath_handlerd, &m->activate_path);
-
if (!must_queue)
dispatch_queued_ios(m);
}
@@ -1111,27 +1102,20 @@ static void pg_init_done(struct dm_path
pg->bypassed = 0;
}
- m->pg_init_in_progress = 0;
- queue_work(kmultipathd, &m->process_queued_ios);
+ m->pg_init_in_progress--;
+ if (!m->pg_init_in_progress)
+ queue_work(kmultipathd, &m->process_queued_ios);
spin_unlock_irqrestore(&m->lock, flags);
}
static void activate_path(struct work_struct *work)
{
int ret;
- struct multipath *m =
- container_of(work, struct multipath, activate_path);
- struct dm_path *path;
- unsigned long flags;
+ struct pgpath *pgpath =
+ container_of(work, struct pgpath, activate_path);
- spin_lock_irqsave(&m->lock, flags);
- path = &m->pgpath_to_activate->path;
- m->pgpath_to_activate = NULL;
- spin_unlock_irqrestore(&m->lock, flags);
- if (!path)
- return;
- ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev));
- pg_init_done(path, ret);
+ ret = scsi_dh_activate(bdev_get_queue(pgpath->path.dev->bdev));
+ pg_init_done(&pgpath->path, ret);
}
/*
next prev parent reply other threads:[~2008-11-13 23:49 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 4:05 [PATCH] Make sure the state of a path is set properly when controller is swapped from passive to active Chandra Seetharaman
2008-11-10 23:17 ` [PATCH] scsi_dh: Adding LSI vendor and product ids in rdac device list Moger, Babu
2008-11-24 0:04 ` James Bottomley
2008-11-24 15:06 ` Moger, Babu
2008-11-11 0:45 ` DM does not activate the paths if there are more than one path in path group during failover Moger, Babu
2008-11-11 0:59 ` Alasdair G Kergon
2008-11-11 17:13 ` Moger, Babu
2008-11-11 21:00 ` Chandra Seetharaman
2008-11-13 23:48 ` Chandra Seetharaman [this message]
2008-11-14 0:12 ` [RFC][PATCH] Handle multipath paths in a path group properly during pg_init (was "RE: DM does not activate the paths if there are more than one path in path group during failover") Alasdair G Kergon
2008-11-14 19:08 ` [RFC][PATCH] Handle multipath paths in a path group properly during pg_init (was "RE: [dm-devel] " Chandra Seetharaman
2008-11-14 19:34 ` [RFC][PATCH] Handle multipath paths in a path group properly during pg_init (was "RE: " Alasdair G Kergon
2008-11-14 20:24 ` [RFC][PATCH] Handle multipath paths in a path group properly during pg_init (was "RE: [dm-devel] " Chandra Seetharaman
2008-11-11 2:06 ` DM does not activate the paths if there are more than one path in path group during failover Chandra Seetharaman
2008-11-11 17:07 ` Moger, Babu
2008-11-11 17:10 ` Chandra Seetharaman
2008-11-11 17:28 ` Moger, Babu
2009-01-22 0:00 ` qla2xxx 0000:03:0c.0: Firmware image unavailable Moger, Babu
2009-01-22 0:26 ` Seokmann Ju
2009-01-22 14:14 ` Moger, Babu
2009-01-22 14:39 ` Sudhakar Pannerselvam
2009-01-22 15:20 ` Moger, Babu
2009-01-22 16:46 ` Dave Holland
2009-01-23 0:15 ` [dm-devel] " Moger, Babu
2009-01-23 6:22 ` Sudhakar Pannerselvam
2009-01-23 15:04 ` James Bottomley
2009-01-25 4:22 ` Mike Snitzer
2009-01-22 14:56 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1226620138.8998.64.camel@chandra-ubuntu \
--to=sekharan@us.ibm.com \
--cc=agk@redhat.com \
--cc=andmike@us.ibm.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=mchristi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox