public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: michaelc@cs.wisc.edu
Cc: dm-devel@redhat.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] RFC: have dm-mpath use already attached scsi_dh
Date: Wed, 22 Apr 2009 11:16:33 +0200	[thread overview]
Message-ID: <49EEE071.9060902@suse.de> (raw)
In-Reply-To: <1240374806-6043-1-git-send-email-michaelc@cs.wisc.edu>

[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

Hi Mike,

michaelc@cs.wisc.edu wrote:
> From: Mike Christie <michaelc@cs.wisc.edu>
> 
> If you have a mixed environment of clarriions, where some
> support ALAU and some support PNR, what do you put in
> your multipath.conf? With this patch you do not have to worry about
> it. If those modules are loaded before dm-mpath, then they
> will have attached to the correct devices based on inquiry, alua commands
> and parsing of data buffers (for example in scsi_dh_emc's alua check).
> There is no need for the user to set that info in the multipath.conf.
> And in general since all scsi_dh_modules will attach to the devices
> they work for, we do not need to have users specific this.
> 
No. The problem here is the hardware table from scsi_dh is compiled
in and cannot be changed from userland. The multipath.conf OTOH
is purely user-defined and, what's more, the user might have a valid
reason for modifying it.
(EG EMC Clariion can well be run in PNR mode even though ALUA is
active, or the user might want to try ALUA on any as-of-yet unknown
devices)

So _not_ allowing multipath to override the device handler setting
will just add to the confusion and makes error tracking even more
difficult.

So I would prefer the attached patch, it even save to touch
device handler code at all.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

[-- Attachment #2: scsi-dh-reattach-handler --]
[-- Type: text/plain, Size: 993 bytes --]

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 095f77b..46d01d9 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -592,12 +592,25 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps,
 	}
 
 	if (m->hw_handler_name) {
-		r = scsi_dh_attach(bdev_get_queue(p->path.dev->bdev),
-				   m->hw_handler_name);
+		struct request_queue *q = bdev_get_queue(p->path.dev->bdev);
+
+		r = scsi_dh_attach(q, m->hw_handler_name);
+		if (r == -EBUSY) {
+			/*
+			 * Already attached to different hw_handler,
+			 * try to reattach with correct one.
+			 */
+			scsi_dh_detach(q);
+			r = scsi_dh_attach(q, m->hw_handler_name);
+		}
 		if (r < 0) {
+			ti->error = "error attaching hardware handler";
 			dm_put_device(ti, p->path.dev);
 			goto bad;
 		}
+	} else {
+		/* Play safe and detach hardware handler */
+		scsi_dh_detach(bdev_get_queue(p->path.dev->bdev));
 	}
 
 	r = ps->type->add_path(ps, &p->path, as->argc, as->argv, &ti->error);

  reply	other threads:[~2009-04-22  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-22  4:33 [PATCH] RFC: have dm-mpath use already attached scsi_dh michaelc
2009-04-22  9:16 ` Hannes Reinecke [this message]
2009-04-22 13:52   ` Mike Christie
2009-04-22 14:15     ` Hannes Reinecke
2009-04-22 17:32   ` Chandra Seetharaman
2009-04-22 17:39     ` Alasdair G Kergon

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=49EEE071.9060902@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /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