From patchwork Tue Jan 5 14:25:49 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: 7955371 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 2AEC09F38D for ; Tue, 5 Jan 2016 14:26:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 324822037F for ; Tue, 5 Jan 2016 14:25:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 246982037E for ; Tue, 5 Jan 2016 14:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751716AbcAEOZ5 (ORCPT ); Tue, 5 Jan 2016 09:25:57 -0500 Received: from mail-bn1on0090.outbound.protection.outlook.com ([157.56.110.90]:18944 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751614AbcAEOZ4 (ORCPT ); Tue, 5 Jan 2016 09:25:56 -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=N2KEcGUiJT6OvtMCaMtsYlZlPpFFxJJiiAI+QVBsfP4=; b=bVV2yy0qHvEBu7Offz6sROiON0UrRMIAPdbnxNIqhQUoTAHZ0wN6HMJdNeQ/sKWqEzzsEOWGYhqkIbbbHVXtYx599mVGvfSc8IQ5reeYtiA9+xesck7rq7UkCSry8dKvX2nIt4svXhkZbk97e3pMTEnD9/bilaxab2U6mytYbw8= Received: from BY2PR02CA0069.namprd02.prod.outlook.com (10.242.32.27) by BL2PR02MB291.namprd02.prod.outlook.com (10.141.90.148) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 14:25:53 +0000 Received: from BL2FFO11FD043.protection.gbl (2a01:111:f400:7c09::154) by BY2PR02CA0069.outlook.office365.com (2a01:111:e400:2c2a::27) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 14:25:52 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; 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 BL2FFO11FD043.mail.protection.outlook.com (10.173.161.139) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 14:25:51 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 96.1E.02821.F62DB865; Tue, 5 Jan 2016 06:25:51 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Tue, 5 Jan 2016 06:25:52 -0800 X-AuditID: ac160a69-f797e6d000000b05-15-568bd26f04dc Received: from [10.50.231.71] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id FD.EE.20697.E62DB865; Tue, 5 Jan 2016 06:25:51 -0800 (PST) Subject: [PATCH 11/15] IB/srpt: Fix how aborted commands are processed To: Doug Ledford References: <568BD0FC.70207@sandisk.com> CC: Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <568BD26D.9080003@sandisk.com> Date: Tue, 5 Jan 2016 15:25:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <568BD0FC.70207@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRmVeSWpSXmKPExsWyRoxnkW7+pe4wgw1NthYvz39gtVi5+iiT xbNDvSwOzB67bzawebzfd5XN4/MmuQDmKC6blNSczLLUIn27BK6MLQsmsRT8UKz4drS6gXGf dBcjJ4eEgInE3pZdzBC2mMSFe+vZuhi5OIQETjBKXD75FcrZziix6Px2VriOG++ZIBKbGSVu Xu5lAUkIC7hJTNn8hgnEFhFQk9j0ahF7FyMHUJGGxLutWSBhZoF4iXWf3jCC2GwCRhLf3s9k ASnhFdCSaLxaCBJmEVCR+PxrNzuILSoQIfFjwxKwcl4BQYmTM5+AbeIU0JT437oLbDozkL1+ lz7EdHmJ7W/nQP2yjFXi6UNDEFtIQF3i5JL5TBMYRWYhmTQLoXsWku4FjMyrGMVyM3OKc9NT CwyN9IoT81Iyi7P1kvNzNzGCo4ArcwfjiknmhxgFOBiVeHg5XnaFCbEmlhVX5h5ilOBgVhLh fX2kO0yINyWxsiq1KD++qDQntfgQozQHi5I4r3WLWpiQQHpiSWp2ampBahFMlomDU6qB0fD7 l4rqWv8r71/6zirkPL7d9oqASsPsoMxDZRHdvs0Ca3oSyp++dDh99VzQzYIND4R3zX/7JECV ob49YpPVtuS1DSunPZCZc//Hi8qbzVXWS95Nea+jkTVzisbXZquKCxVBkwp4+dyy2zlWFMZt 2Kuxcv3DSdI31783Or9Rpef+m9RJwuaTZyuxFGckGmoxFxUnAgC7zg5rfgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsXCtZEjRTf/UneYQdctLYuX5z+wWqxcfZTJ 4tmhXhYHZo/dNxvYPN7vu8rm8XmTXABzFJdNSmpOZllqkb5dAlfGlgWTWAp+KFZ8O1rdwLhP uouRk0NCwERi7433TBC2mMSFe+vZuhi5OIQENjJKLO/7xgKSEBZwk5iy+Q1YkYiAmsSmV4vY uxg5gIo0JN5tzQIxmQXiJe52glWwCRhJfHs/kwUkzCugJdF4tRAkzCKgIvH51252EFtUIELi x4YljCA2r4CgxMmZT8AWcQpoSvxv3QVWwyygLvFn3iVmCFteYvvbOcwTGPlnIWmZhaRsFpKy BYzMqxjFcjNzinPTMwsMjfSKE/NSMouz9ZLzczcxgkORM2oH4/WJ5ocYmTg4pRoYpSsSH7rZ vWb5xThX+sB3v8nb7172cX+0gzdji2Tnng02Gh71kes3HuvVUoy7GrDn8v3Wr585j5Urny14 7XFv9or/0Vb9L1vYrsxh1nkh53SBrYcj4r0c+4Z81lXmFVU/XmStSy4Vlp3559MNY+E1TUsn zHm9SPrIlS3sj95Jv+DrPd084f3tOUosxRmJhlrMRcWJAEaARlv1AQAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD043; 1:ZJ6mSg5ckLdvtXYceXeYFDGnPkN3MoZ+KcAm9cughsQI8smInXZqsxO1UK8YYuqFVWhjMFcMGAztzYY28kvvFCnTJ+0fwF0zkNeGIH9oSRI+fdLaS/9cdbkYzfMJG2JoBx2ghcn/ySInuJbensI5lCKDfo9XybrLBk6gA2eY+0oIhBKTCXx2AXMDFW2YZXdvpF1XKx8Wi2FhfNJVJCRx/gmCTRYe9tUYofum6UT3xAwVleuJqJJAKrvJINKR8Xpx79QfllHMKSNwSuc6r7qEmAqcjOlukKkugxdbSvONJ+38VB0DWCkp66bUW/f9IkgWFdAH0J5nhq/6RVQbn6tVWSPO54EYmga4qQQvqa5Q3QPPCO4p3n8R7htDADgM3YpH X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(33656002)(50466002)(106466001)(110136002)(64126003)(81156007)(1220700001)(65956001)(83506001)(5001960100002)(1096002)(229853001)(97736004)(65806001)(189998001)(19580395003)(4001350100001)(36756003)(23676002)(87936001)(586003)(80316001)(86362001)(65816999)(59896002)(87266999)(5008740100001)(2950100001)(4326007)(54356999)(92566002)(77096005)(50986999)(230700001)(47776003)(76176999)(69596002)(19580405001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB291; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB291; 2:gdI1RMYURx8kbRcEyAjehOGUCQRm9cZ2NMNfH1ZrpVvGR1V7rpjrTSK2BBR2Il71OuMVlvWDYTzq9zn4D+oQtUecE2MZLRE4HXCjBdMfA8Wxg2a/ip/K5qJEDuhLPh8Hs4BrZhJit4A2c+LBtGZnFw==; 3:eqCuqJOx90P0tO2pxB5Cqr2aCUGcoEs6sbILRnK/0x0mfzbzwii1dtlZGTcphqe97b+Qr1P9ZYoNABopfTdHQeK31op8367ml3X0dKPfcq088IzXAysdg6Xe4ONmyEOpMXMfLY7qh0F4GEjSkGi23ffrGXbsIkjvrLUuKCcoz6kZ3t9jWh27pa/EjDBeNq1ctEVehoKUBljfSogdHwRX/vCsZiIiwYzaiH4oHKw9PBc17xmZLLc5WVCHAZ03v7ic9HvOGDE6fcKZWZh5NysBAg==; 25:DcANHajFXhE4UNsxo9KdCVfDHbhW6i3hn91oMDsTrjMF5L0hNoOP00Fvo2eIHU1MjDvLMWF+lU1dOABC7otby8ucNGUkW6So2zR5olzGeiu73Pgimgd3snahr12BZ+H71Nr9uDy3fvN6VuklBS4dgGXnHBE7I3gzQtm8SmhgDlehFIwOE0p0rWjaeDIaCf2zPNqx8BixPIZ+2pzI6pDmgJDg7W1KP5uOY4M8rpU6Qd/SrjefZPt2d1jozNfFDxna X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2PR02MB291; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB291; 20:zdndQnRJlCy0xsmH71jfHjBRJSrndiLk2qMs4RJsfvLfCylMg6euaQ92iNmFtiWloBJAVPWYBKCYLfinGB+Dm327B2iym/RSViaKVW1Ba92BTguCvDV62TymOmhVqEO8Ckr5yL0CdY29wyCG/GKdXhfe8Es2l4CgvXsszIMhwj+NDot1JqDjsL3XUokm+b6q7UiM8R49ihxCygt3hWwBdgfNI+LqWdq+sLDliasTLujD183SdB298qnuj3mdXSoo7HxC8Y1mLw+TCiGPLQTpQr3XRR/YuDqla9Tmcim78s/CmmW5kVge3MH/fSsC06zv++0PDpCZork0kSd/rvVr0XZ/xkaZPU7POorOjBmIsv9GL86igXZSYwZ6TMbgsn9NwqvZEgt3zZOhdQUTOlflSsSpsZE3+rmtqzWEFd3NNYIMzxokOVhFRTpqD7Rsuu541M+CcCo2UmRSIeAgnmGZfYnotKQZopvQ1wS6Rt+eFXVoR2YMXhKRSiABQNFda8nk; 4:yEElx47HvpdcQ+vIhA3Amdu08GJr41+QkyKzPCO0YS6QZOhGjeVgN9oemJXyG6N6mTeslYSUr2pSQ97FwEAn1PiMqN1snSeqySWBqYi88K6Sxma7d6rJ0Si7abp8Jakll4EsL+R77f4aFkL4300ykEYDQSEfKLMG86dLY0vJXqAR6xnIrTDxzor/xJbTu1pS/j+qQlRVG1SneSBrdlO+u7G0xNCjKtfcRO9JpmVNk1AHmzQYVvJXZWraitrGVKqKPi1wH7pWFgz2bxGd+uvonF53d9BxZHFoNFpUT9X1ZUz2EAvyx7Uk7eja204sfL36Se9YLDTyseMKCFBky9B91fVD1CEM1AXavskN9b+rx4fZSQ9Sarez6KoZkDOPHtlKDXNbK9y1nm79fRjkxfgA8uD/2iw48GURKYLxLHH YnT8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001); SRVR:BL2PR02MB291; BCL:0; PCL:0; RULEID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GQIomirtlKM817RpFLryQCNY16wGfeBRFDK/wXF/uSJfbrHvLA/Wi2Qx3ozX4LogcxARtAf5Ppa6+Bkw=; 20:Rdhv0yH+iGXHhnyz55POd6XSSgkA3xFTurm8KyNTkQdSMD+qJ2oxmZ2j6E9Td2t+5eojsy09cWbj/lRLHxW4eOSl8YWe2Y7YzxK8fXhfO4aupaQb0nICWrWjEnr8/3en1DOQpATD2YjgbPJ9KWdGhrI04v9s9052ZJZOoj9kkVFWzKc4qyS9T6dXmXH/AjU1d6MxlPUGo8vfaihO9BE8ddRdMq5SUC5lBNxCwD6NSaOP0bHHnM6y9j7IiX+D3alw SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 14:25:51.9972 (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: BL2PR02MB291 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 srpt_abort_cmd() must not be called in state SRPT_STATE_DATA_IN. Issue a warning if this occurs. srpt_abort_cmd() must not invoke target_put_sess_cmd() for commands in state SRPT_STATE_DONE because the srpt_abort_cmd() callers already do this when necessary. Hence remove this call. If an RDMA read fails the corresponding SCSI command must fail. Hence add a transport_generic_request_failure() call. Remove an incorrect srpt_abort_cmd() call from srpt_rdma_write_done(). Avoid that srpt_send_done() calls srpt_abort_cmd() for finished SCSI commands. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig --- drivers/infiniband/ulp/srpt/ib_srpt.c | 39 ++++++++++++++--------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 395bc1b..2ae3c1b 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1273,25 +1273,17 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) case SRPT_STATE_NEED_DATA: ioctx->state = SRPT_STATE_DATA_IN; break; - case SRPT_STATE_DATA_IN: case SRPT_STATE_CMD_RSP_SENT: case SRPT_STATE_MGMT_RSP_SENT: ioctx->state = SRPT_STATE_DONE; break; default: + WARN_ONCE(true, "%s: unexpected I/O context state %d\n", + __func__, state); break; } spin_unlock_irqrestore(&ioctx->spinlock, flags); - if (state == SRPT_STATE_DONE) { - struct srpt_rdma_ch *ch = ioctx->ch; - - BUG_ON(ch->sess == NULL); - - target_put_sess_cmd(&ioctx->cmd); - goto out; - } - pr_debug("Aborting cmd with state %d and tag %lld\n", state, ioctx->cmd.tag); @@ -1299,14 +1291,16 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) case SRPT_STATE_NEW: case SRPT_STATE_DATA_IN: case SRPT_STATE_MGMT: + case SRPT_STATE_DONE: /* * Do nothing - defer abort processing until * srpt_queue_response() is invoked. */ - WARN_ON(!(ioctx->cmd.transport_state & CMD_T_ABORTED)); break; case SRPT_STATE_NEED_DATA: - /* DMA_TO_DEVICE (write) - RDMA read error. */ + pr_debug("tag %#llx: RDMA read error\n", ioctx->cmd.tag); + transport_generic_request_failure(&ioctx->cmd, + TCM_CHECK_CONDITION_ABORT_CMD); break; case SRPT_STATE_CMD_RSP_SENT: /* @@ -1314,18 +1308,16 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) * not been received in time. */ srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); - target_put_sess_cmd(&ioctx->cmd); + transport_generic_free_cmd(&ioctx->cmd, 0); break; case SRPT_STATE_MGMT_RSP_SENT: - srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); - target_put_sess_cmd(&ioctx->cmd); + transport_generic_free_cmd(&ioctx->cmd, 0); break; default: WARN(1, "Unexpected command state (%d)", state); break; } -out: return state; } @@ -1365,9 +1357,14 @@ static void srpt_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc) container_of(wc->wr_cqe, struct srpt_send_ioctx, rdma_cqe); if (unlikely(wc->status != IB_WC_SUCCESS)) { + /* + * Note: if an RDMA write error completion is received that + * means that a SEND also has been posted. Defer further + * processing of the associated command until the send error + * completion has been received. + */ pr_info("RDMA_WRITE for ioctx 0x%p failed with status %d\n", ioctx, wc->status); - srpt_abort_cmd(ioctx); } } @@ -1716,15 +1713,10 @@ static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc) atomic_inc(&ch->sq_wr_avail); - if (wc->status != IB_WC_SUCCESS) { + if (wc->status != IB_WC_SUCCESS) pr_info("sending response for ioctx 0x%p failed" " with status %d\n", ioctx, wc->status); - atomic_dec(&ch->req_lim); - srpt_abort_cmd(ioctx); - goto out; - } - if (state != SRPT_STATE_DONE) { srpt_unmap_sg_to_ib_sge(ch, ioctx); transport_generic_free_cmd(&ioctx->cmd, 0); @@ -1733,7 +1725,6 @@ static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc) " wr_id = %u.\n", ioctx->ioctx.index); } -out: while (!list_empty(&ch->cmd_wait_list) && ch->state == CH_LIVE && (ioctx = srpt_get_send_ioctx(ch)) != NULL) {