linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: linux-scsi@vger.kernel.org
Cc: dm-devel@redhat.com, Mike Snitzer <snitzer@redhat.com>,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH 1/2] scsi_dh: Allow NULL hardware handler name in scsi_dh_attach()
Date: Mon,  2 Apr 2012 18:43:54 +0200	[thread overview]
Message-ID: <1333385035-6663-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1333385035-6663-1-git-send-email-hare@suse.de>

This patch allows to pass in a NULL hardware handler to
scsi_dh_attach(), causing the reference count of the existing
hardware handler to be increased.
An error will be returned if no hardware handler is attached.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/device_handler/scsi_dh.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
index 48e46f5..77fa67e 100644
--- a/drivers/scsi/device_handler/scsi_dh.c
+++ b/drivers/scsi/device_handler/scsi_dh.c
@@ -475,10 +475,14 @@ int scsi_dh_attach(struct request_queue *q, const char *name)
 {
 	unsigned long flags;
 	struct scsi_device *sdev;
-	struct scsi_device_handler *scsi_dh;
+	struct scsi_device_handler *scsi_dh = NULL;
 	int err = 0;
 
-	scsi_dh = get_device_handler(name);
+	if (name) {
+		scsi_dh = get_device_handler(name);
+	} else if (sdev->scsi_dh_data) {
+		scsi_dh = sdev->scsi_dh_data->scsi_dh;
+	}
 	if (!scsi_dh)
 		return -EINVAL;
 
-- 
1.7.7


  reply	other threads:[~2012-04-02 16:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 16:43 [PATCH 0/2] 'default' hardware handler for multipath Hannes Reinecke
2012-04-02 16:43 ` Hannes Reinecke [this message]
2012-04-02 17:06   ` [PATCH 1/2] scsi_dh: Allow NULL hardware handler name in scsi_dh_attach() Mike Snitzer
2012-04-03  1:46   ` [dm-devel] " Jun'ichi Nomura
2012-04-02 16:43 ` [PATCH 2/2] dm-mpath: Allow 'default' hardware handler Hannes Reinecke
2012-04-02 17:04   ` Mike Snitzer
2012-04-02 17:07     ` Hannes Reinecke
2012-04-03  1:45       ` [dm-devel] " Jun'ichi Nomura
2012-04-03 21:12 ` [dm-devel] [PATCH 0/2] 'default' hardware handler for multipath Moger, Babu
2012-04-18 14:07   ` Hannes Reinecke
2012-04-18 16:25     ` Moger, Babu

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=1333385035-6663-2-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=snitzer@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;
as well as URLs for NNTP newsgroup(s).