From patchwork Sun Jun 19 11:48:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 894742 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5JCBPvB011753 for ; Sun, 19 Jun 2011 12:11:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753614Ab1FSMLX (ORCPT ); Sun, 19 Jun 2011 08:11:23 -0400 Received: from jester.euphonynet.be ([212.87.96.13]:42029 "EHLO mailpush2.euphonynet.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284Ab1FSMLX (ORCPT ); Sun, 19 Jun 2011 08:11:23 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 19 Jun 2011 12:11:25 +0000 (UTC) X-Greylist: delayed 1369 seconds by postgrey-1.27 at vger.kernel.org; Sun, 19 Jun 2011 08:11:22 EDT Received: from smtp2.euphonynet.be (smtp2.euphonynet.be [212.87.96.4]) by mailpush2.euphonynet.be (Postfix) with ESMTP id EACFB4F83B1; Sun, 19 Jun 2011 13:48:31 +0200 (CEST) Received: from localhost (goose.euphonynet.be [212.87.96.12]) by smtp2.euphonynet.be (Postfix) with ESMTP id B03302B6416D6; Sun, 19 Jun 2011 13:53:44 +0200 (CEST) X-Virus-Scanned: by UltraDeluxeScanner at at euphonynet.be Received: from smtp2.euphonynet.be ([212.87.96.4]) by localhost (goose.euphonynet.be [212.87.96.23]) (amavisd-new, port 10024) with ESMTP id nyg+vUE8wQMn; Sun, 19 Jun 2011 13:48:25 +0200 (CEST) Received: from asus.localnet (unknown [62.88.24.21]) by smtp2.euphonynet.be (Postfix) with ESMTP id 0CA082B6415D4; Sun, 19 Jun 2011 13:53:38 +0200 (CEST) From: Bart Van Assche To: linux-scsi@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH 1/2] IB/srp: Fix SCSI scanning Date: Sun, 19 Jun 2011 13:48:24 +0200 User-Agent: KMail/1.13.6 (Linux/2.6.38.8-scst; KDE/4.6.0; x86_64; ; ) Cc: Roland Dreier , David Dillow MIME-Version: 1.0 Message-Id: <201106191348.24122.bvanassche@acm.org> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Avoid that SCSI scanning triggers creation of targets with non-zero channel or non-zero id. Signed-off-by: Bart Van Assche Cc: Roland Dreier Cc: David Dillow Cc: Signed-off-by: David Dillow --- 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,