From patchwork Thu Apr 30 08:57:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 6300791 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 18B65BEEE1 for ; Thu, 30 Apr 2015 09:12:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECC6B2015A for ; Thu, 30 Apr 2015 09:12:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A00B22013A for ; Thu, 30 Apr 2015 09:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750803AbbD3JMI (ORCPT ); Thu, 30 Apr 2015 05:12:08 -0400 Received: from mail-bl2on0059.outbound.protection.outlook.com ([65.55.169.59]:30976 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750811AbbD3JMG (ORCPT ); Thu, 30 Apr 2015 05:12:06 -0400 Received: from BY2PR02CA0115.namprd02.prod.outlook.com (25.163.44.169) by BN3PR0201MB1027.namprd02.prod.outlook.com (25.161.207.149) with Microsoft SMTP Server (TLS) id 15.1.148.16; Thu, 30 Apr 2015 08:57:44 +0000 Received: from BN1AFFO11FD005.protection.gbl (2a01:111:f400:7c10::165) by BY2PR02CA0115.outlook.office365.com (2a01:111:e400:5261::41) with Microsoft SMTP Server (TLS) id 15.1.148.16 via Frontend Transport; Thu, 30 Apr 2015 08:57:44 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BN1AFFO11FD005.mail.protection.outlook.com (10.58.52.65) with Microsoft SMTP Server id 15.1.160.8 via Frontend Transport; Thu, 30 Apr 2015 08:57:39 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 00.2A.14695.28EE1455; Thu, 30 Apr 2015 01:57:38 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.224.2; Thu, 30 Apr 2015 01:57:38 -0700 X-AuditID: ac160a69-f79656d000003967-6e-5541ee82eca6 Received: from [10.50.231.61] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 3D.DC.19112.18EE1455; Thu, 30 Apr 2015 01:57:38 -0700 (PDT) Message-ID: <5541EE80.6070505@sandisk.com> Date: Thu, 30 Apr 2015 10:57:36 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Doug Ledford CC: James Bottomley , Sagi Grimberg , Sebastian Parschauer , linux-rdma , "linux-scsi@vger.kernel.org" Subject: [PATCH 03/12] IB/srp: Remove an extraneous scsi_host_put() from an error path References: <5541EE21.3050809@sandisk.com> In-Reply-To: <5541EE21.3050809@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42JZI8azSLfpnWOowan/VhYvz39gtfi//jaL xbNDvSwW3dd3sFncaHvAZnHyNr8Dm8ez6YeZPA7/+MHs8efPZ2aP9/uusnl83iQXwBrFZZOS mpNZllqkb5fAlfF1zRTWgqkCFWe75jI1ME7l7WLk5JAQMJF4+vYXC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4BDmjNzB+HSi+SFGJg5OqQbGWYcebhXsYJx4Pu/TN7taVV2Prb8MzXheb5tldiYnc8a9 sC2aPPccZuQ0PFnY3nbboW/WBda1WvvN9VIMGWWU5z1ZPPmYnanq5AW7vnOsm8X15fS0z/Pu hz6+9M/wo0OKb4X5j9WbRXy3pXDffvFul/gKl6Wnm89VvLw2M/yaTKnz+ScdTFO6ZJRYijMS DbWYi4oTAT5SX8ARAgAA X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(199003)(189002)(50466002)(77096005)(87266999)(64126003)(229853001)(2950100001)(87936001)(106466001)(47776003)(65956001)(23676002)(19580395003)(50986999)(65816999)(110136002)(46102003)(62966003)(54356999)(59896002)(86362001)(19580405001)(76176999)(4001350100001)(83506001)(92566002)(36756003)(65806001)(80316001)(77156002)(33656002)(5001960100002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0201MB1027; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0201MB1027; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN3PR0201MB1027; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0201MB1027; X-Forefront-PRVS: 056297E276 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2015 08:57:39.6337 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0201MB1027 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix a scsi_get_host() / scsi_host_put() imbalance in the error path of srp_create_target(). See also patch "IB/srp: Avoid that I/O hangs due to a cable pull during LUN scanning" (commit ID 34aa654ecb8e). Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer Cc: #v3.19 Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srp/ib_srp.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 918814c..5ce6cfd 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3172,11 +3172,11 @@ static ssize_t srp_create_target(struct device *dev, ret = srp_parse_options(buf, target); if (ret) - goto err; + goto out; ret = scsi_init_shared_tag_map(target_host, target_host->can_queue); if (ret) - goto err; + goto out; target->req_ring_size = target->queue_size - SRP_TSK_MGMT_SQ_SIZE; @@ -3187,7 +3187,7 @@ static ssize_t srp_create_target(struct device *dev, be64_to_cpu(target->ioc_guid), be64_to_cpu(target->initiator_ext)); ret = -EEXIST; - goto err; + goto out; } if (!srp_dev->has_fmr && !srp_dev->has_fr && !target->allow_ext_sg && @@ -3208,7 +3208,7 @@ static ssize_t srp_create_target(struct device *dev, spin_lock_init(&target->lock); ret = ib_query_gid(ibdev, host->port, 0, &target->sgid); if (ret) - goto err; + goto out; ret = -ENOMEM; target->ch_count = max_t(unsigned, num_online_nodes(), @@ -3219,7 +3219,7 @@ static ssize_t srp_create_target(struct device *dev, target->ch = kcalloc(target->ch_count, sizeof(*target->ch), GFP_KERNEL); if (!target->ch) - goto err; + goto out; node_idx = 0; for_each_online_node(node) { @@ -3315,9 +3315,6 @@ err_disconnect: } kfree(target->ch); - -err: - scsi_host_put(target_host); goto out; }