From patchwork Fri Jan 29 23:15:14 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: 8168581 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AAFE9F96D for ; Fri, 29 Jan 2016 23:15:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77182201C8 for ; Fri, 29 Jan 2016 23:15:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F7D0201B4 for ; Fri, 29 Jan 2016 23:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbcA2XPU (ORCPT ); Fri, 29 Jan 2016 18:15:20 -0500 Received: from mail-bn1bon0055.outbound.protection.outlook.com ([157.56.111.55]:45699 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753391AbcA2XPS (ORCPT ); Fri, 29 Jan 2016 18:15:18 -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=mARvdzBpH/dJ7/4/dYI+46snob1gXJlTGwBkqXxhfmU=; b=kCOjLWhoipQAqm/FddG5+JogfBWGgwPgobcryazOiVPk9tLuGYyOind2MpTYVEshGxjGaqF9VU+FTNOB5Ng/FQPKH4T7ZBU1aGZo2LgYyrD6qmtnVvVW03vhWqC/ap6QRw0Xdh4cSLqIqieN3I7nf5anfUBW4JdyPvGxi7J3C4Y= Received: from BY2PR02CA0089.namprd02.prod.outlook.com (10.242.32.47) by BY2PR0201MB0824.namprd02.prod.outlook.com (10.160.125.152) with Microsoft SMTP Server (TLS) id 15.1.396.15; Fri, 29 Jan 2016 23:15:16 +0000 Received: from BN1BFFO11FD040.protection.gbl (2a01:111:f400:7c10::1:112) by BY2PR02CA0089.outlook.office365.com (2a01:111:e400:2c2a::47) with Microsoft SMTP Server (TLS) id 15.1.390.13 via Frontend Transport; Fri, 29 Jan 2016 23:15:16 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.174) smtp.mailfrom=sandisk.com; mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.174 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.174; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.174) by BN1BFFO11FD040.mail.protection.outlook.com (10.58.144.103) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Fri, 29 Jan 2016 23:15:15 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id 2E.A8.25823.382FBA65; Fri, 29 Jan 2016 15:15:15 -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; Fri, 29 Jan 2016 15:15:15 -0800 X-AuditID: ac160a69-647ff700000064df-96-56abf283523d Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id A3.67.02700.282FBA65; Fri, 29 Jan 2016 15:15:14 -0800 (PST) Subject: [PATCH v2 11/22] IB/srpt: Fix srpt_close_session() To: Doug Ledford References: <56ABF16E.7070006@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56ABF282.1030809@sandisk.com> Date: Fri, 29 Jan 2016 15:15:14 -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: <56ABF16E.7070006@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGLMWRmVeSWpSXmKPExsWyRoxnkW7zp9VhBg9PcFhcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CVsfjRGcaCHtGKwxOWsjYwPhPsYuTkkBAwkWja+5G9i5GLQ0hgE6PE11k3mUASQgI7 GCXWbLWFKZpxuZENomgOo8S7E53MIAlhAWuJ6b/3gNkiAmoSm14tYodo1pI4d+EL2FRmgVWM EpuuXgdLsAkYSXx7P5Oli5GDgxeoaMbVEpAwi4CqROPL8ywgtqhAhMThzi6wcl4BQYmTM5+A xTkFtCWWzL4A1sosoCmxfpc+SJhZQF5i+9s5zCCrJAQOskrMeXiXFeIGdYmTS+YzTWAUnoVk 1CyE9llI2hcwMq9iFMvNzCnOTU8tMDTSK07MS8ksztZLzs/dxAiODa7MHYwrJpkfYhTgYFTi 4V2wYnWYEGtiWXFl7iFGCQ5mJRHeuhdAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rzWLWphQgLp iSWp2ampBalFMFkmDk6pBkZ3+SVrr3P7LqiddvW0/OfnNoFqFwr6jr17G9q158i3ZZsSo1Jv BDj06vryRP8+NMvzAUOo2uJ8e93rfBNF515Q6L5/2NF90Sanb+w2uc+WOTn78kjd/iy3R9jz dCZH/8bfD6+3uS5+Un2C+2CNRLxz/v1rS5z+N7xeNplxcomkgcbtlDVxZbFKLMUZiYZazEXF iQBQ+ziliQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsXCtZEjRbfp0+owgxXvTSwuPP3OZPHy/AdW i5WrjzJZPDvUy2Jxo+0BmwOrx+I9L5k8dt9sYPN4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Antispam-Report: CIP:63.163.107.174; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(11100500001)(36756003)(83506001)(80316001)(19580395003)(19580405001)(77096005)(5008740100001)(229853001)(189998001)(106466001)(87936001)(50466002)(1096002)(586003)(86362001)(33656002)(1220700001)(64126003)(2950100001)(230700001)(92566002)(4001350100001)(65806001)(65956001)(47776003)(110136002)(5001960100002)(2906002)(87266999)(65816999)(23676002)(4326007)(50986999)(76176999)(54356999); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB0824; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0824; 2:F4ToY2gScmvQEFWd2HiTzulbeqB5M/5IlJjRdyGrtExHSG97XmOI6Sm7YosLFoqc7mYIypnzkWpGavczBFIDKtn9PW8BMuE5VDSldh8yqsTI5sqpMoLMx58GzQJGe81ytrBBhNb5k0p32eJhTw+10w==; 3:TI0CvdHFbUbjS2LnQ1AGu5njrfDoGifu+QECB6vCKR5OdhGQTJZSE8BR+vv2NcE16vFryTBRswoIjqGR/XBdTbmoMoVCXPHZUFslvBYB5z137ZD8n+xBknOXir8Se8p6dGyacZSZUpPI/ZDvtyGLcB8J679efrZNkefcbMabRMzrhdV/CgQnONuOoh3IY3679hGsjmQG5TKIXMDRekyu9TLxlKR9MQNRQQdH6UybYJffWtCZSlPUWnkgFMmv2hfk2awfjwnC0zwbTcKvZSE7lQ==; 25:m7Ghg4J6JbG4LHc1TgCYOKRp3QBK7NL5k0tWE+NKdSM+nV5DjIi1mHzpvctG+9tv7C0mvz+FiUvGRbUwv+8srjCVP0V7RoWcqfv7JPodAg98LHaWeIc0sCvkGrK3KhpcO90zjovDfB5ooNPeL4QHIsxYOGwSzx3MtuuwXxI51hcqhWsBsr46EHygUOtQWYiHAc0chjhhLPT3kAEryOeJkjBgjYLHBX3QC1XmFEYn/7dhGxiAEc9Xhe72mirLAfft X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BY2PR0201MB0824; X-MS-Office365-Filtering-Correlation-Id: 5d63cbf0-02ff-4d88-5d31-08d329020c45 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0824; 20:xBre1xPrl/WpBdC0Kf8YAaSOc+9lcuo6ydadx15VFHhvdAYwxBPzJVXVPcgHuchy8V669vYXojVt1C//Srbp8vCph5ZYw88h8s3YH7Hae/H/hKtvk2Nk1VIE60kTGN0HjtrO+AYB+hYDR4vDpstJDHGoXAvaHK62nRBiKlKiYY25h8Lx2C3qaqUzRw5N7PgnOF/NAFXAnR+uh634Wf6itZ1nUmMGhx2PODBPPd6qLJ6heiasfVNuIjP5WUw2+ctJYnUp+/H8s6ZnOZsZfbvGGfQ1CN7og2PWrRfDGQXN+XgWqn2BGfiJTDmBdQURRSDZFKSn9qtGkSlmg1BpFWWcbOnGWdCB/0E7liXF9+F4dORiNcWetWwTTspkjPFPrzTKcOh2VGn6QDZBvluMRrZotPSQqTCi7cSyKFklyckGeBcuCShWfUtSpIxo0AflrGBWpqmiBKfutPyDRNojF9WH2rWCxD+2GfVzL5AyTfBFz42Jh2ShDksxjQgkVF8+SDqG 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)(13018025)(13017025)(8121501046)(13023025)(13024025)(13015025)(5005006)(3002001)(10201501046); SRVR:BY2PR0201MB0824; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB0824; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0824; 4:pBqruNSeSrlPTeZ46Gmq3R3EpDWNSeBR3JQys6ckdfLQm21oPlWHaMGo8FU3fUtQPgckH52sJi3kCmzjPQK7CuvFLGNxq1evJxrIB5E7Ze0/yAw72XSvIfUD+VuiDRbJ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Ni?= =?utf-8?B?eE9IRitYSEFVWkhONnF6RndBN2EyN0JKU0ZXQVR4L2dxWHFkSUF4cWRGeC9C?= =?utf-8?Q?orx5IozvvNpNJX4R9YHhbx1N81X8i?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0824; 5:dDCyiFcZRRAY2kpD52M6+EIy6MppRFB7ExjWhKEqUoSroZyUyyRLVVOr4Z+8H0MHJW9aQua/mT8ENb6KGmIftkHjAmDbSpllXeUTD6aeDPbOmAxoGVcTctdOxVYkLipxb61bMNFj/a1QNxtP/5iIxA==; 24:7xV2OyQDza7gEDTkswaBFuKS3MPCyC7dBakgkm+42cdZqTY8lJoz7qUHgd5xlqjOvhBlCq7oLZOj0b1APy9wI9BSvysV21mmfzIhizZW7Bs=; 20:h1O9v5jLxPM5JhaYCNOqXPVGIRP2r+3L25b13dLVZnBOUZxzwt5a/FBbR34uyujH7ISE0mscrCwldh3OXK1PJwsQoiZ1yso1BhX9DCUctXKppTZvDRrNlMMXLlEPGSzqLpmUdCxYGDHxtIJgLJYCbwbQ0lyLNelwheNqMKI4DwmzKPhRqxETs7eka7Y26EQHqD4A0zYzlT/R8aQnAPW1Uou++oH56XhGBijBueSGOkxbNnnlmZAp0kjwQut0GYb/ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2016 23:15:15.5989 (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.174]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB0824 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.8 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 --- 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 d892736..eb6f812 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); @@ -3020,24 +3019,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); } /**