From: Chandra Seetharaman Subject: Re: [PATCH] Reattach device_handler for multipathing Date: Thu, 23 Apr 2009 11:12:51 -0700 Message-ID: <1240510371.3138.0.camel@chandra-ubuntu> References: <20090423063529.DB686D381C@pentland.suse.de> Reply-To: sekharan@linux.vnet.ibm.com, device-mapper development Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20090423063529.DB686D381C@pentland.suse.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: device-mapper development Cc: Alasdair Kergon List-Id: dm-devel.ids On Thu, 2009-04-23 at 08:35 +0200, Hannes Reinecke wrote: > When specifying a different hardware handler via multipath > features we should be able to override the built-in defaults. > > Signed-off-by: Hannes Reinecke Acked-by: Chandra Seetharaman > --- > drivers/md/dm-mpath.c | 14 ++++++++++++-- > 1 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c > index 095f77b..e6611de 100644 > --- a/drivers/md/dm-mpath.c > +++ b/drivers/md/dm-mpath.c > @@ -592,9 +592,19 @@ 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; > }