From patchwork Mon May 18 11:23:14 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: 6428081 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 05ABAC0432 for ; Mon, 18 May 2015 11:23:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DF72205EB for ; Mon, 18 May 2015 11:23:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2382E205DC for ; Mon, 18 May 2015 11:23:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752560AbbERLXY (ORCPT ); Mon, 18 May 2015 07:23:24 -0400 Received: from mail-bl2on0061.outbound.protection.outlook.com ([65.55.169.61]:63124 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753481AbbERLXX (ORCPT ); Mon, 18 May 2015 07:23:23 -0400 Received: from BY2PR02CA0028.namprd02.prod.outlook.com (10.141.216.18) by BY2PR02MB282.namprd02.prod.outlook.com (10.242.236.146) with Microsoft SMTP Server (TLS) id 15.1.160.19; Mon, 18 May 2015 11:23:19 +0000 Received: from BL2FFO11FD010.protection.gbl (2a01:111:f400:7c09::105) by BY2PR02CA0028.outlook.office365.com (2a01:111:e400:2c40::18) with Microsoft SMTP Server (TLS) id 15.1.166.22 via Frontend Transport; Mon, 18 May 2015 11:23:19 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; profitbricks.com; 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 BL2FFO11FD010.mail.protection.outlook.com (10.173.161.16) with Microsoft SMTP Server id 15.1.172.14 via Frontend Transport; Mon, 18 May 2015 11:23:17 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 19.27.06265.4ABC9555; Mon, 18 May 2015 04:23:16 -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; Mon, 18 May 2015 04:23:16 -0700 X-AuditID: ac160a69-f790f6d000001879-fd-5559cba4cf5f Received: from [10.50.231.56] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id F3.E7.03643.2ABC9555; Mon, 18 May 2015 04:23:16 -0700 (PDT) Message-ID: <5559CBA2.5040305@sandisk.com> Date: Mon, 18 May 2015 13:23:14 +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 v2 03/12] IB/srp: Remove an extraneous scsi_host_put() from an error path References: <5559CB3A.6060102@sandisk.com> In-Reply-To: <5559CB3A.6060102@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42JZI8azSHfJ6chQg8v9hhYvz39gtfi//jaL xbNDvSwW3dd3sFncaHvAZnHyNr8Dm8ez6YeZPA7/+MHs8efPZ2aP9/uusnl83iQXwBrFZZOS mpNZllqkb5fAlXGyby1rwTyBis8HDrM2MM7j7WLk5JAQMJFo37WHHcIWk7hwbz1bFyMXh5DA CUaJqYf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Cur8/NlcdECNaWKe8tUX3nPe9shJ72F1iuqP i+U7czh/YYV74aeFczWZVugqtxcs0dRrfPeA53DP39mFK7lsZ6yM83499fldyQpux0X9U037 hTbVTT2R3Rr4Q8r4SFjv7W8RMsE5Oos2r3CYPS3l3uVG+xeMt2pN94Wamm09/kCJpTgj0VCL uag4EQDX8oz9EgIAAA== X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD010; 1:EXBFcEpQOlalVaVmI3kiJBDPjMsZldwNWvq1kBCVOWLOwuQ4Vb6DQSH1icJNG4atbpSttdAHkv+V7YhzSdyFuE9Uz7wJS8vr/cMoJifxjGoHlgezVOdyGchnDJ+leeGUMaibKY47Ldg1F3L4y7vTScGwDR+HFr5vJ1iKuKgF4JM9pYvwoKjJt9bB8ZN6QlVvKTZaTfJFS4RrYhse2pAz/7/D4SjFBtWggmQe/ctXGtd4Yl/YFPQHoRnQIsM8pC+mV7T1bWA7+pgcC8Mw94oS/xEq5fbjBL8gK10X9UHUR2J+zCr/x8wgQEL9LnWs8+IPGfelqz+JHQnYNIJDA55Uww== X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(199003)(189002)(77096005)(87266999)(65956001)(47776003)(65806001)(50466002)(62966003)(69596002)(4001540100001)(5001960100002)(54356999)(110136002)(189998001)(50986999)(64706001)(65816999)(76176999)(5001860100001)(5001830100001)(2950100001)(77156002)(36756003)(81156007)(19580395003)(4001350100001)(80316001)(19580405001)(97736004)(86362001)(68736005)(92566002)(229853001)(83506001)(46102003)(87936001)(33656002)(23676002)(59896002)(106466001)(64126003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB282; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB282; 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:BY2PR02MB282; BCL:0; PCL:0; RULEID:; SRVR:BY2PR02MB282; X-Forefront-PRVS: 058043A388 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2015 11:23:17.2489 (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: BY2PR02MB282 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 Reviewed-by: Sagi Grimberg Cc: Sebastian Parschauer Cc: #v3.19 --- 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 4ee91aa..cdb7a71 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3188,11 +3188,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; @@ -3203,7 +3203,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 && @@ -3224,7 +3224,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(), @@ -3235,7 +3235,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) { @@ -3331,9 +3331,6 @@ err_disconnect: } kfree(target->ch); - -err: - scsi_host_put(target_host); goto out; }