public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: linux-scsi@vger.kernel.org, linux-rdma@vger.kernel.org
Cc: Roland Dreier <roland@purestorage.com>, David Dillow <dillowda@ornl.gov>
Subject: [PATCH 1/2] IB/srp: Fix SCSI scanning
Date: Sun, 19 Jun 2011 13:48:24 +0200	[thread overview]
Message-ID: <201106191348.24122.bvanassche@acm.org> (raw)

Avoid that SCSI scanning triggers creation of targets with non-zero
channel or non-zero id.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Roland Dreier <roland@purestorage.com>
Cc: David Dillow <dillowda@ornl.gov>
Cc: <stable@kernel.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index ee165fd..de4fd32 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -110,6 +110,11 @@ static const char *srp_target_info(struct Scsi_Host *host)
 	return host_to_target(host)->target_name;
 }
 
+static int srp_target_alloc(struct scsi_target *starget)
+{
+	return starget->channel == 0 && starget->id == 0 ? 0 : -ENODEV;
+}
+
 static int srp_target_is_topspin(struct srp_target_port *target)
 {
 	static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };
@@ -1836,6 +1841,7 @@ static struct scsi_host_template srp_template = {
 	.name				= "InfiniBand SRP initiator",
 	.proc_name			= DRV_NAME,
 	.info				= srp_target_info,
+	.target_alloc			= srp_target_alloc,
 	.queuecommand			= srp_queuecommand,
 	.eh_abort_handler		= srp_abort,
 	.eh_device_reset_handler	= srp_reset_device,
-- 
1.7.3.4


             reply	other threads:[~2011-06-19 11:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-19 11:48 Bart Van Assche [this message]
2011-06-19 17:27 ` [PATCH 1/2] IB/srp: Fix SCSI scanning David Dillow
     [not found]   ` <1308504469.14467.5.camel-1q1vX8mYZiGLUyTwlgNVppKKF0rrzTr+@public.gmane.org>
2011-06-19 18:03     ` Bart Van Assche
2011-06-20 11:37       ` Christoph Hellwig
2011-06-20 17:53         ` Bart Van Assche

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=201106191348.24122.bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=dillowda@ornl.gov \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=roland@purestorage.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