qubes-linux-kernel/patches.suse/dm-mpath-detach-existing-hardware-handler

60 lines
1.7 KiB
Plaintext
Raw Normal View History

From 27d169318cbd6c8647f689e8dcff08920040408a Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 19 Nov 2009 14:39:24 +0100
Subject: [PATCH] multipath: detach existing hardware handler if none was specified
Patch-mainline: not yet
When no hardware handler was specified in the multipath configuration
we should be detaching any existing ones. Otherwise unpredictable
results will happen.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/md/dm-mpath.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -642,23 +642,27 @@ static struct pgpath *parse_path(struct
memcpy(p->path.pdev, p->path.dev->name, 16);
}
- if (m->hw_handler_name && p->path.dev) {
+ if (p->path.dev) {
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);
+ if (m->hw_handler_name) {
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;
+ 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(q);
}
if (m->hw_handler_params) {