From patchwork Thu Feb 4 22:50:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 8228691 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 341F1BEEE5 for ; Thu, 4 Feb 2016 22:51:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 20C4D2039C for ; Thu, 4 Feb 2016 22:51:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AB2020390 for ; Thu, 4 Feb 2016 22:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965764AbcBDWvb (ORCPT ); Thu, 4 Feb 2016 17:51:31 -0500 Received: from mail-bn1on0071.outbound.protection.outlook.com ([157.56.110.71]:38539 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965756AbcBDWv2 (ORCPT ); Thu, 4 Feb 2016 17:51:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rXiYi5FevSNtq0B9NMJF+xgZurX0JHJRMZg+DmfIMkw=; b=PpSpfx/2TKnvIbyeu3MCgAuRGGTc4k/ylnpoQOnE7bkxJIcQgJrLeMpkBxy4rI1C8DJxKXNzjDLewElQAZFMwqpRoiw0ZSKN6LtYsLmrsWAZNOmM5F1HqsJZTGoCJ7GdGkMRhZYF7LuEp7RdCKIhbCetXY8i8/T7y4SXjGzUzJw= Received: from BY1PR0201CA0027.namprd02.prod.outlook.com (10.160.191.165) by BN1PR0201MB0820.namprd02.prod.outlook.com (10.160.170.152) with Microsoft SMTP Server (TLS) id 15.1.390.13; Thu, 4 Feb 2016 22:51:26 +0000 Received: from BL2FFO11FD047.protection.gbl (2a01:111:f400:7c09::182) by BY1PR0201CA0027.outlook.office365.com (2a01:111:e400:4814::37) with Microsoft SMTP Server (TLS) id 15.1.403.16 via Frontend Transport; Thu, 4 Feb 2016 22:51:26 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BL2FFO11FD047.mail.protection.outlook.com (10.173.161.209) with Microsoft SMTP Server id 15.1.409.7 via Frontend Transport; Thu, 4 Feb 2016 22:51:25 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id 36.6E.02415.CE5D3B65; Thu, 4 Feb 2016 14:51:24 -0800 (PST) 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.248.2; Thu, 4 Feb 2016 14:50:21 -0800 X-AuditID: ac160a68-afc369800000096f-56-56b3d5ec3464 Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 5E.6E.02402.DA5D3B65; Thu, 4 Feb 2016 14:50:21 -0800 (PST) Subject: [PATCH v3 10/21] IB/srpt: Fix srpt_close_session() To: Doug Ledford References: <56B3D453.7030409@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56B3D5AD.2030803@sandisk.com> Date: Thu, 4 Feb 2016 14:50:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56B3D453.7030409@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRoxnke6bq5vDDBa+V7e48PQ7k8XL8x9Y LVauPspk8exQL4vFjbYHbA6sHov3vGTy2H2zgc3j2fTDTB7v911l8/i8SS6ANYrLJiU1J7Ms tUjfLoErY9vMVSwFW0Ur/m45ztTA2CXUxcjJISFgInFyykf2LkYuDiGBTYwS1/t+s0A42xkl 3s56zQxTdXX+MUaIxBxGiXc9J9hAEsIC1hIv97xiBLFFBNQkNr1axA5iCwloSUxdNxNsLLPA GkaJiTO2gjWwCRhJfHs/E2gFBwcvUNGXZ6YgYRYBFYkft6YxgdiiAhEShzu7wObwCghKnJz5 hAXE5hTQllh5axFYK7OApsT6XfogYWYBeYntb+cwg6ySEDjIKtG8p4MJ4gZ1iZNL5jNNYBSe hWTULIT2WUjaFzAyr2IUy83MKc5NTy0wNNQrTsxLySzO1kvOz93ECI4OrowdjFsnmR9iFOBg VOLhPbB2c5gQa2JZcWXuIUYJDmYlEd6OC0Ah3pTEyqrUovz4otKc1OJDjNIcLErivNYtamFC AumJJanZqakFqUUwWSYOTqkGRvYIbi2HsydnXEkPPTVf/rhYZJ3VvlvzSz4xSc76rGBbM69b qd8ldfFkC91WZnePqXHz89ucPq1VeH19jWN2+0um99LfhV/fl63P/uhoWc3KlbxyxQnFuatK LE5Z+CzY+PKGZEXx7/lbNtZYuXKdimZj/N/+bsOxqwI15/2ef4o69pn14o82GSWW4oxEQy3m ouJEAIO5p6qKAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsXCtZEjRXft1c1hBm+3ilhcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CVsW3mKpaCraIVf7ccZ2pg7BLqYuTkkBAwkbg6/xhjFyMXh5DALEaJaS9fMIEkhAWs JV7uecUIYosIqElserWIHcQWEtCSmLpuJjtIA7PAKkaJ3ys/sIEk2ASMJL69n8nSxcjBwQtU 9OWZKUiYRUBF4setaWAzRQUiJA53doHN4RUQlDg58wkLiM0poC2x8tYiMJtZQF3iz7xLzBC2 vMT2t3OYJzDyzULSMgtJ2SwkZQsYmVcxiuVm5hTnpmcWGBrqFSfmpWQWZ+sl5+duYgSHKGfk DsanE80PMTJxcEo1MLrvd4k3ebJj00vLFvZliz/U/VDn2l6+x3b65t9XdJ9029QdnMZ0Qfij s+2pjt4fIdMZdqt82VP/0udT/TerZYJxjd2aSUx7elj6Fl8MfC6Yzvq4e+U6c1fPOTxBfu+u 37eZLrqM68sPj37BFRVZXwWnmrgw1HM7dr6X2sqdJSGXw8UeEzX/kxJLcUaioRZzUXEiAI9a mKQBAgAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD047; 1:idN8ABVJ5nkm+m62zNYR0520paHpaUpFOWovd5CSJPdo7DJYEPalZbnXvva8kkbXN2WQlcCaReJ1zRqP6q2VpoVS26WivKy06sp+NkwbVlEu/O5Ix1m9k2c0w/WNplpPleop6QoN3fd5/YoReAqkgZzufLtSYVmFZn6rWzHkD1qCfsHuM2jbOafywRyScZhP+wwCteijKcEdFRYe7sdHolR8opgvUK25R/igbD/ajvtc0Jhda4Bd5FTLFCmvKbrFeQq8r9ISJg/SnqQw/foVzvSPD7cI+L1zr9+CyT3OIC+QzDKOyO4oASiTiBIQdsLjqNq/pjcXDIKCy+6jQn4yneaqzwvyF6iOc9EcuCunMIISPmU6qc0ZUeThsmx/nNmOpZf1RovoFqbvwo0mhowhgQ== X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(2906002)(4326007)(36756003)(5008740100001)(230700001)(83506001)(77096005)(54356999)(586003)(1220700001)(4001350100001)(110136002)(65806001)(229853001)(106466001)(2950100001)(64126003)(33656002)(86362001)(59896002)(23676002)(87936001)(50466002)(65816999)(50986999)(87266999)(19580395003)(76176999)(189998001)(80316001)(1096002)(11100500001)(19580405001)(5001960100002)(92566002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0820; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 2:ME6KXRWFLLTly0fFgIQiNoNWUMbhNNqfXPvYtwNQG2cEEJ8eWpEs7srp6LzJ/rqpKaqTZ45IfegXSDlL6hwb6BmeIR37DTfkl1+jcs+JKubn/uhaSuGRY/JCuaEvpUOcpcWERidOegpFVNhmxa7BVA==; 3:8LgAuH7qdCZsNlczmDlIGlttlsrPIqyJBSiueJqJ5UPp7jMORL+wIA/sMrvgWli0SMHQrJ4hRlXSNm7wuULjHmKlVT6QsNw7IhH4/S9ntT5JjRRSJoaxL4/13l5WRWTwtzFSd4UtFzP4rvOL/mEjBrUNe/yKpVicPr3dU1TB253rh//JAxv1PfN7mYZRS6604tpESDziMkTJGj8kCoKTDzzzwcsMui24EE1ReVD7gZrrwRnZHNBnSsMWufLN9CM06jGKHGSx27A2X8H+/31XDw==; 25:UV3qUfyN1YSx7vCEIsZONSLKN7/Rnmu9HGlu0uMSNdQtEfeMrp11QkgF6D0AHT8hD9QhK8s17i7CZcHJFpMEphxvp16vRGaUl+ZklIRQ8qnpntLfQ/RaqXdfRrmwtpGpTi5J0KaJOusKZ/lvNxNIvxNqX6iVoxYmPP7bi3WTHKe5xkXs3JLx8zSzD2FZ2YshSPZU3oFA1AxKKAQk2fhZXEraMisB+Lx3Xyy5SYrLvfDTWDqWQIZDdAeTWTREyh+duDc0AJiok/US/+j5vWUVpECj/wQZ+bOlQJ7cMrZiCSoX996UWf/k0wxgNMPRhHC/ X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BN1PR0201MB0820; X-MS-Office365-Filtering-Correlation-Id: 0b19681e-78d7-4b0c-3eac-08d32db5b607 X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 20:QfXo+5R48lDIavHm574yrytZSFcMMka0p+sJnWMf+nR2Qs05IzZ5vF66l6UqtBlZzCPr4zlmvOgH0Y6ZdPYpqyMfVqEyCHkq3AWMwgDazv3xExS1naB4WN4y8hUUdic64Z2sBKez8vgapG7NJBwhE8+LUEEbqP9tryO5137UWJlCYG1wzdJDwp1JU5XRQLijf/dLPR5NoImud3hRb9kyU3cX3w3mWhVIhURDs1rR8fnsIA6RZot3rX3pDogcGsSoHgKR128zM3kupZgdet5bVnRHhwK8VNG0yYEQN4Y5hrxiDdl4g2dbIirvFc4cPVj9Py4p+25hQGlhXTEUQjuXSZ/0lsZwbM4mASBd/YvMQeZeOJk5BexVsJhP3wuckkNYQGFYl/Q1jhLK+Z+2kohWQlwLs4iSPwdnxTEV0PoMM8YD2P4H28p9Q3fLo7ssfuUV+CRl2TJji3MWJwi1FFaGUW18LfU3DE8Nws81HkaBRZ66HUQcNBcfCxIKPLcLCzpI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(34787635062028)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13024025)(13017025)(13023025)(5005006)(8121501046)(3002001)(10201501046); SRVR:BN1PR0201MB0820; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0820; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 4:cOld/DhvXmh3PGHZduV68QMdIVBw5fKG55ve4eKJH/Myu1v1386Roz/hHmSZCya9m1eQUzPfDi89rNlwOMjqpHk73dXzdV6GQs6qm1lWljQDkve8Ra9q3PkCpJBhHYMBLQOHcn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?YzhjWWU2RDJ4YnlsamxYelVGcGxtVjhLZUFIOEVsMFVuUTFsa2pUYmtkQzRh?= =?utf-8?Q?trEESD4m00B1TE6JrAM3CxZv1Jigc?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 5:DZU2BDcq1AmF/MfUw/Rg6qe+jsjyCAL/X7R+UlmxlKnO6DwBz9G543eltsh3Y2wgwQz8OP/o4sqWA1Y0uEJ2r0GM8/g/svuDNDnTDWbNuFpiCv3LrlfzTfkh9Qi8Az4sMQx1p20iwXNUQ/vhDsR2KA==; 24:XgRHOmWCJbPkWZLSyVMptKnzxc8jaewZjHoRJspqaL0zVXeQCpOudyHCh235VYeIGNv30Fk8eVIln9zWhfj0dodebqfqiH8HkCbDatGq138=; 20:DzAVDIE7Po1RPdkGdsPe7oScJlDRu9zhcM7YaKNdOnJFX1PLeumViRYwMxFU8KM5zq5jzb0lHXQ01kIX5MPHbp8/7aUaR9ZXc/OX9tNCWs6t4t43qmp8FNeyoHxvCzVNuqqeGspLmj2fzHjcIBlytcYcJjdveNp3ho8Z/cQshxU1c8l0kXj8B4lF9eKr99lbB9txRnBUmx95VL3THVBbSMn2hUZ1XqKZKx484jO+CfViLOyGVEO+Adty8QX6GgHT SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2016 22:51:25.0638 (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.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0820 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Avoid that srpt_close_session() waits if it doesn't have to wait. Additionally, increase the time during which srpt_close_session() waits until closing a session has finished. This makes it easier to detect session shutdown bugs. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Cc: Alex Estrin --- drivers/infiniband/ulp/srpt/ib_srpt.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 55118da..88013ca 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1986,8 +1986,8 @@ static void srpt_release_channel_work(struct work_struct *w) struct se_session *se_sess; ch = container_of(w, struct srpt_rdma_ch, release_work); - pr_debug("ch = %p; ch->sess = %p; release_done = %p\n", ch, ch->sess, - ch->release_done); + pr_debug("%s: %s-%d; release_done = %p\n", __func__, ch->sess_name, + ch->qp->qp_num, ch->release_done); sdev = ch->sport->sdev; BUG_ON(!sdev); @@ -2011,11 +2011,10 @@ static void srpt_release_channel_work(struct work_struct *w) ch->rsp_size, DMA_TO_DEVICE); spin_lock_irq(&sdev->spinlock); - list_del(&ch->list); - spin_unlock_irq(&sdev->spinlock); - + list_del_init(&ch->list); if (ch->release_done) complete(ch->release_done); + spin_unlock_irq(&sdev->spinlock); wake_up(&sdev->ch_releaseQ); @@ -3025,24 +3024,26 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) static void srpt_close_session(struct se_session *se_sess) { DECLARE_COMPLETION_ONSTACK(release_done); - struct srpt_rdma_ch *ch; - struct srpt_device *sdev; - unsigned long res; - - ch = se_sess->fabric_sess_ptr; - WARN_ON(ch->sess != se_sess); + struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr; + struct srpt_device *sdev = ch->sport->sdev; + bool wait; - pr_debug("ch %p state %d\n", ch, ch->state); + pr_debug("ch %s-%d state %d\n", ch->sess_name, ch->qp->qp_num, + ch->state); - sdev = ch->sport->sdev; spin_lock_irq(&sdev->spinlock); BUG_ON(ch->release_done); ch->release_done = &release_done; + wait = !list_empty(&ch->list); __srpt_close_ch(ch); spin_unlock_irq(&sdev->spinlock); - res = wait_for_completion_timeout(&release_done, 60 * HZ); - WARN_ON(res == 0); + if (!wait) + return; + + while (wait_for_completion_timeout(&release_done, 180 * HZ) == 0) + pr_info("%s(%s-%d state %d): still waiting ...\n", __func__, + ch->sess_name, ch->qp->qp_num, ch->state); } /**