From patchwork Wed Apr 22 09:16:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 19335 X-Patchwork-Delegate: agk@redhat.com Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3M9GsvQ022602 for ; Wed, 22 Apr 2009 09:16:55 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 86EA1618531; Wed, 22 Apr 2009 05:16:53 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n3M9GqCT007270 for ; Wed, 22 Apr 2009 05:16:52 -0400 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3M9Gpt2012716 for ; Wed, 22 Apr 2009 05:16:51 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n3M9Gat5016251 for ; Wed, 22 Apr 2009 05:16:36 -0400 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id EAEA64844E; Wed, 22 Apr 2009 11:16:33 +0200 (CEST) Message-ID: <49EEE071.9060902@suse.de> Date: Wed, 22 Apr 2009 11:16:33 +0200 From: Hannes Reinecke User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: michaelc@cs.wisc.edu References: <1240374806-6043-1-git-send-email-michaelc@cs.wisc.edu> In-Reply-To: <1240374806-6043-1-git-send-email-michaelc@cs.wisc.edu> X-Enigmail-Version: 0.95.7 X-RedHat-Spam-Score: -3.839 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, linux-scsi@vger.kernel.org Subject: [dm-devel] Re: [PATCH] RFC: have dm-mpath use already attached scsi_dh X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Hi Mike, michaelc@cs.wisc.edu wrote: > From: Mike Christie > > 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 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);