From patchwork Tue Oct 7 13:04:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 5045901 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C2B449F30B for ; Tue, 7 Oct 2014 13:04:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E22BB201FB for ; Tue, 7 Oct 2014 13:04:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1EA02017D for ; Tue, 7 Oct 2014 13:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753708AbaJGNE0 (ORCPT ); Tue, 7 Oct 2014 09:04:26 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:35712 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753686AbaJGNE0 (ORCPT ); Tue, 7 Oct 2014 09:04:26 -0400 Received: from [192.168.1.117] ([178.117.55.239]) by albert.telenet-ops.be with bizsmtp id 0D4R1p00B59gWLa06D4RV3; Tue, 07 Oct 2014 15:04:25 +0200 Message-ID: <5433E4D9.60500@acm.org> Date: Tue, 07 Oct 2014 15:04:25 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Christoph Hellwig CC: Jens Axboe , Sagi Grimberg , Sebastian Parschauer , Robert Elliott , Ming Lei , "linux-scsi@vger.kernel.org" , linux-rdma Subject: [PATCH v2 05/12] IB/srp: Move ib_destroy_cm_id() call into srp_free_ch_ib() References: <5433E43D.3010107@acm.org> In-Reply-To: <5433E43D.3010107@acm.org> 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 The patch that adds multichannel support into the SRP initiator driver introduces an additional call to srp_free_ch_ib(). This patch helps to keep that later patch simple. Signed-off-by: Bart Van Assche Reviewed-by: Sagi Grimberg Cc: Sebastian Parschauer --- drivers/infiniband/ulp/srp/ib_srp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 62d2a18..d3c712f 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -555,6 +555,11 @@ static void srp_free_target_ib(struct srp_target_port *target) struct srp_device *dev = target->srp_host->srp_dev; int i; + if (target->cm_id) { + ib_destroy_cm_id(target->cm_id); + target->cm_id = NULL; + } + if (dev->use_fast_reg) { if (target->fr_pool) srp_destroy_fr_pool(target->fr_pool); @@ -868,7 +873,6 @@ static void srp_remove_target(struct srp_target_port *target) scsi_remove_host(target->scsi_host); srp_stop_rport_timers(target->rport); srp_disconnect_target(target); - ib_destroy_cm_id(target->cm_id); srp_free_target_ib(target); cancel_work_sync(&target->tl_err_work); srp_rport_put(target->rport); @@ -3043,7 +3047,7 @@ static ssize_t srp_create_target(struct device *dev, if (ret) { shost_printk(KERN_ERR, target->scsi_host, PFX "Connection failed\n"); - goto err_cm_id; + goto err_free_ib; } ret = srp_add_target(host, target); @@ -3067,9 +3071,6 @@ out: err_disconnect: srp_disconnect_target(target); -err_cm_id: - ib_destroy_cm_id(target->cm_id); - err_free_ib: srp_free_target_ib(target);