From patchwork Wed Jan 17 00:14:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10168341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03087600CA for ; Wed, 17 Jan 2018 00:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED6DC26E47 for ; Wed, 17 Jan 2018 00:14:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E231327528; Wed, 17 Jan 2018 00:14:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E6A726E47 for ; Wed, 17 Jan 2018 00:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbeAQAOe (ORCPT ); Tue, 16 Jan 2018 19:14:34 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:17774 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbeAQAOV (ORCPT ); Tue, 16 Jan 2018 19:14:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1516148062; x=1547684062; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=iODnJ1ZIHJpVQYwMbO8ffs42/cVV0RAD5P6BmJi1vBM=; b=pMZN+LBV2GkHmo+5LLdDZqQ5Hk5YVee2/4mUd/igEXedYciDo6vwEwR5 cPID+8GmKPodO7OkSX2EMYyDl6U97kfX8tdqlIc4f2S4hSAWpoNK6FT8b +21oeHuMWwJGN/YaEWdU4GkBnXuhwq8D04V/VvjThi6yspnEskUYrGpom wpCdJ5//TbOExw5t42RCRGWejqvvlqvNHsSVS5x9udhsf91QVTt8Rvd5u qYeY5YpT38Z0bHh67BsTTymQ0M0v0k49WZkpGj/6YXOCF7rMidX5aSYhK ebJ59DItN2GMKFfcBGnEfaycDGkDEkwaikYZs3k4/uNj7OYeyrsf5piC5 Q==; X-IronPort-AV: E=Sophos;i="5.46,369,1511798400"; d="scan'208";a="69677740" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 17 Jan 2018 08:14:20 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 16 Jan 2018 16:09:35 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip01.wdc.com with ESMTP; 16 Jan 2018 16:14:20 -0800 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche Subject: [PATCH v2 07/14] IB/srpt: Simplify srpt_close_session() Date: Tue, 16 Jan 2018 16:14:11 -0800 Message-Id: <20180117001418.7852-8-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180117001418.7852-1-bart.vanassche@wdc.com> References: <20180117001418.7852-1-bart.vanassche@wdc.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move a mutex lock and unlock statement from srpt_close_session() into srpt_disconnect_ch_sync(). Since the previous patch removed the last user of the return value of that function, change the return value of srpt_disconnect_ch_sync() into void. Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index de3e77df146e..b248515a4fe4 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1868,22 +1868,16 @@ static bool srpt_ch_closed(struct srpt_port *sport, struct srpt_rdma_ch *ch) return res; } -/* - * Send DREQ and wait for DREP. Return true if and only if this function - * changed the state of @ch. - */ -static bool srpt_disconnect_ch_sync(struct srpt_rdma_ch *ch) - __must_hold(&sdev->mutex) +/* Send DREQ and wait for DREP. */ +static void srpt_disconnect_ch_sync(struct srpt_rdma_ch *ch) { struct srpt_port *sport = ch->sport; - int ret; - - lockdep_assert_held(&sport->mutex); pr_debug("ch %s-%d state %d\n", ch->sess_name, ch->qp->qp_num, ch->state); - ret = srpt_disconnect_ch(ch); + mutex_lock(&sport->mutex); + srpt_disconnect_ch(ch); mutex_unlock(&sport->mutex); while (wait_event_timeout(sport->ch_releaseQ, srpt_ch_closed(sport, ch), @@ -1891,8 +1885,6 @@ static bool srpt_disconnect_ch_sync(struct srpt_rdma_ch *ch) pr_info("%s(%s-%d state %d): still waiting ...\n", __func__, ch->sess_name, ch->qp->qp_num, ch->state); - mutex_lock(&sport->mutex); - return ret == 0; } static void __srpt_close_all_ch(struct srpt_port *sport) @@ -2991,11 +2983,8 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) static void srpt_close_session(struct se_session *se_sess) { struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr; - struct srpt_port *sport = ch->sport; - mutex_lock(&sport->mutex); srpt_disconnect_ch_sync(ch); - mutex_unlock(&sport->mutex); } /**