public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: linux-scsi@vger.kernel.org
Cc: Brian King <brking@linux.vnet.ibm.com>,
	Fujita Tomonori <fujita.tomonori@lab.ntt.co.jp>
Subject: [PATCH 2/2] [SCSI] ibmvscsi: Fix SCSI scanning
Date: Sun, 19 Jun 2011 13:48:40 +0200	[thread overview]
Message-ID: <201106191348.40759.bvanassche@acm.org> (raw)

Avoid that SCSI scanning triggers creation of targets with a non-zero
channel number.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Brian King <brking@linux.vnet.ibm.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: <stable@kernel.org>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Note: this patch hasn't been tested yet.

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 3d391dc..c31adf5 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -498,6 +498,11 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 	spin_unlock_irqrestore(hostdata->host->host_lock, flags);
 }
 
+static int ibmvscsi_target_alloc(struct scsi_target *starget)
+{
+	return starget->channel == 0 ? 0 : -ENODEV;
+}
+
 /**
  * ibmvscsi_reset_host - Reset the connection to the server
  * @hostdata:	struct ibmvscsi_host_data to reset
@@ -1803,6 +1808,7 @@ static struct scsi_host_template driver_template = {
 	.module = THIS_MODULE,
 	.name = "IBM POWER Virtual SCSI Adapter " IBMVSCSI_VERSION,
 	.proc_name = "ibmvscsi",
+	.target_alloc = ibmvscsi_target_alloc,
 	.queuecommand = ibmvscsi_queuecommand,
 	.eh_abort_handler = ibmvscsi_eh_abort_handler,
 	.eh_device_reset_handler = ibmvscsi_eh_device_reset_handler,
-- 
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-20 11:40 ` [PATCH 2/2] [SCSI] ibmvscsi: Fix SCSI scanning Christoph Hellwig
2011-06-20 17:58   ` Bart Van Assche
2011-06-20 19:10     ` Brian King
2011-06-20 19:06 ` Brian King

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.40759.bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=brking@linux.vnet.ibm.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    /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