From patchwork Thu Feb 11 19:07:11 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: 8284601 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 E91A0BEEE5 for ; Thu, 11 Feb 2016 19:07:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D038420222 for ; Thu, 11 Feb 2016 19:07:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7520D20121 for ; Thu, 11 Feb 2016 19:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750765AbcBKTHT (ORCPT ); Thu, 11 Feb 2016 14:07:19 -0500 Received: from mail-by2on0078.outbound.protection.outlook.com ([207.46.100.78]:6512 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750777AbcBKTHR (ORCPT ); Thu, 11 Feb 2016 14:07:17 -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=Zhq6/yHf0lSZ2Vgk2E9MFfZHPhiVWUtlVhDTmjPpvSM=; b=t1ID9BGYH/M4y2thEvEdIySxCCL48avVn08T7eOwlKljQWonDEjrnfv4yZc02IpoOlTRSpP/bRIEV252iThzG3BsgRLrJr2PYrea2gUcaVyLJQiFdHHWnj/N4r56K0dF0pTY4nHuI7h16Fqu5knnk7ewlosBIgbUz07fSNwYB9Q= Received: from BY2PR02CA0094.namprd02.prod.outlook.com (10.242.32.52) by BL2PR02MB290.namprd02.prod.outlook.com (10.141.90.145) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 19:07:12 +0000 Received: from BY2FFO11OLC008.protection.gbl (2a01:111:f400:7c0c::137) by BY2PR02CA0094.outlook.office365.com (2a01:111:e400:2c2a::52) with Microsoft SMTP Server (TLS) id 15.1.403.16 via Frontend Transport; Thu, 11 Feb 2016 19:07:11 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; intel.com; dkim=none (message not signed) header.d=none;intel.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 BY2FFO11OLC008.mail.protection.outlook.com (10.1.14.255) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Thu, 11 Feb 2016 19:07:11 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id FD.16.02658.FDBDCB65; Thu, 11 Feb 2016 11:07:11 -0800 (PST) Received: from milsmgip11.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; Thu, 11 Feb 2016 11:07:11 -0800 X-AuditID: ac160a68-723ff70000000a62-1f-56bcdbdf0104 Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 46.E7.02402.FDBDCB65; Thu, 11 Feb 2016 11:07:11 -0800 (PST) Subject: [PATCH v4 12/21] IB/srpt: Fix how aborted commands are processed To: Doug Ledford References: <56BCDAAD.7030906@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56BCDBDF.7080801@sandisk.com> Date: Thu, 11 Feb 2016 11:07:11 -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: <56BCDAAD.7030906@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRoxnke7923vCDNa1SVpcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CV8WHXUuaCUxoVJx83sTYw/lHoYuTkkBAwkdj25CVTFyMXh5DAJkaJj81foJwdjBJb Hz1ih6n6feIBM0RiDqPE4/27wBLCAp4Sv2YsBLNFBNQkNr1aBGYLCWhJPO/vZwVpYBZYxSix 6ep1sASbgJHEt/czWUBsXqCix1v+s4HYLAKqEmef9IDZogIREoc7u9ghagQlTs58AlTPwcEp oC0x80oEiMksoCmxfpc+SAWzgLzE9rdzwG6TENjLKtH0/jsTxA3qEieXzGeawCg8C8mkWQjt s5C0L2BkXsUolpuZU5ybnlpgaKhXnJiXklmcrZecn7uJERwdXBk7GLdOMj/EKMDBqMTDe+P6 njAh1sSy4srcQ4wSHMxKIrz3NwGFeFMSK6tSi/Lji0pzUosPMUpzsCiJ81q3qIUJCaQnlqRm p6YWpBbBZJk4OKUaGEXq7bJmau/InvKmedbFCcvroiZt4fHTYXB3bD9wMDZz99mrVn58/V/e zd334X1M9LSLHSa/Cl3uNqQpylX9FG1yu8ZX0apjMaFnS9sRS+Z3Op1JlzTC4husZh7ffPbY fTb/3lcyc5mX2sotrf7sL93RfCbovfXxj49mfvvs6may9MJ2z6r0N0osxRmJhlrMRcWJABje qpiKAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsXCtZEjRff+7T1hBq3TuSwuPP3OZPHy/AdW i5WrjzJZPDvUy2Jxo+0BmwOrx+I9L5k8dt9sYPN4Nv0wk8f7fVfZPD5vkgtgjeKySUnNyS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WPROExjy/ZkJLm4 X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(3190300001)(199003)(189002)(19580405001)(5001960100002)(2906002)(189998001)(575784001)(92566002)(4326007)(65806001)(33656002)(50466002)(86362001)(11100500001)(230700001)(5008740100001)(1220700001)(65956001)(59896002)(23676002)(586003)(64126003)(1096002)(54356999)(87266999)(50986999)(47776003)(65816999)(76176999)(2950100001)(77096005)(19580395003)(106466001)(4001350100001)(229853001)(80316001)(87936001)(36756003)(83506001)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB290; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB290; 2:mgoM9uMdr1MRo2FF5kyg6rvuoV2VfZYU6b1CeVC4ys75MaPLEeuBXnaBV2GilkH6yEo4zjZm2XSLtqhggZ65tlB9jVi1fUNoLzczD30JeGqGpquhaL5VWyLwvcyHBXTh4aTeLocu1dNnOy+g0JfgzA==; 3:IRQpv5WQfz7ql98Swua6zverh7pA7iB4+QgIepLdkD7NhuFc1hfPJnQVxQKXQ5I4PdB3xLmtXyXbK1kLuOrP1eXFLXaYcWbnAN8d+y2elHSOUJpciq/Kit9VOzkjgmewLBA9OWlXmiraD9ZBUYqrVLt8oTM5hY3J3E1902JXfrxzPjChXfYZjZF1/gjf7IS5E8KaJ+83r11RODvlVE9DhC4to+hDRGbmGcbGdr3/EyVPdfxtvEbgGE4/JVwbEU16ITWKAhEYNIjj2WDhg76o9Q==; 25:9WCqkSKZPR9ITL5BiJ3ZY8/sUgneq0SgdEJWN4myUeeCnhXJw2omx7/TzWkIEHr3mXpeee0iX7klKUfaL84oAVhosRq8RZdzoH6cNLKGeC5AjsM0jauBol2iwYigueykrdPvjNTW/mb5D4fQGpDJWOGUM24ruFCwgC/38eG2Q1JkY1MP7RnlJ88q3B88xsdx3yq2P3JFQhLZCpcQQqPWSOq7QQ7oA8/LkrcJHlpjVqdLI1fEiQ2RkgJ6SgngF2vNtrufHZkEPJUoQwY4FTeSokHfGJ4cflLqhBUUiAre17JB52kGPnyu0YwDalX7AQho X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2PR02MB290; X-MS-Office365-Filtering-Correlation-Id: 4befbe27-a7b8-4942-ac9e-08d333168ba9 X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB290; 20:45cxBLt7ver3o3M5gtpC9LJCMJQEafGEzBsxZfSe3f83JcF45M2qXIC0r2rFxz3nVXAp9dE/FoTE+h6yBnzjIUpYW1oDAa8c8XqbhTwoJZNIjfqQA9glw4FsGdWtg+jJJvXo7BzABSaMnTi1ngbSRWD/jQSUmgvWS1CT/uCWBGE/dVkOEKggOM3963jB/I2sc6jXnjgLBVYbC258Hu2K6iUbTYLmmn8M6TxJnxHEIYzGykoVo5TZWsK5ufNVH/TWMlrPZ8NIoue5LNAblFqmzyPFPfiJvQc6v7ESiDy2Jg8c3KiqUhgl5VcRlFXpB/GTG+lxMjO4MkAGe6hN/L7gBIbwKCGPyaaDOY3A+uPdkLXbSHnZJM93EQio7mQFRQiJgOyLcqNRWwIjp8bbPpLttlBRu5pSdEw8euQPenI6cSAEDsG9yK9aEEA9X4zUDDRxcUyAiKNsGhMxqI0t97TL/R9+OFfmlAm2rDTO+AP1K9Ts2Z+NONn1L/QUemXbS4ho X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13015025)(13024025)(13017025)(13018025)(5005006)(8121501046)(3002001)(10201501046); SRVR:BL2PR02MB290; BCL:0; PCL:0; RULEID:; SRVR:BL2PR02MB290; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB290; 4:tU7bfHoWc9D1mj/He7EUWDnHPeFii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2aEJPdm44Z2s3V0hnczBmbzlOYWdBa3ZxZXlMbkQ2Q2ZuU20vUDBRMjB5?= =?utf-8?B?aEJsdGJ3Sllyc3ZvREdVdXprV0MvV0hYc0Z2U2JsVUZOMHVSRDRLdnZHbkly?= =?utf-8?B?RmUrWUxFWjhzMlVKemVoNEFPSDhEUjg0T2pmak5UWWtrQ3JlVVdUelI3NWdF?= =?utf-8?Q?gF847Z7Mi63C1S76p3KgccQ7CcuA8p8u3ha++UpA3cEBQ?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB290; 5:ZVcePdVrzkEg+t+r9qRzIuN3NuPwK+yluI7HWocFBFaAOaG24PsVcMvNNUVcCdktVi3CAOOTYjd737nnHpOcu0MZ9xLJRMNV/g3C6VCEf9q5p+yU2WtNNzNuM8otuVjWUNuuo4rjC7ugGMJMjeIcEg==; 24:gDQsg4loizWXudP6qm52Qa9Sy4VWxYZNWscbP5K4eXwESnDja6XBYkDI0ctaQa9ccDwYsk/OIc+slDqSAVKSkKdR6SHJRKh8nU7u/O10hBg=; 20:ktk6hK0Wz3XBQ1OtHW69MEgDXp6Uepqlx6s6kReRIdVi9KURgvhdEDKZbQlLlXUdLf07ffgHJVIclAi4xyMtEXCAnNikkOs7QBl0Ha0mijYYBbgg9f7N52GB+aNSvXcnNs465L6NS02eQ/UnZw6CZm657OQqOKKLXPgSw6qcSHjuooE8xZIQK0fmHyt5K8G0EMIxf9i3jywVeYzRxXFroned10n+3KGWBda99lynUNknL6aNFAUntZHcL0QXhH7k SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 19:07:11.4353 (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: BL2PR02MB290 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.0 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 Reviewed-by: Christoph Hellwig Reviewed-by: Alex Estrin Cc: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 49 ++++++++++++----------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 5b0fbc1..64e9107 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1267,10 +1267,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) /* * If the command is in a state where the target core is waiting for - * the ib_srpt driver, change the state to the next state. Changing - * the state of the command from SRPT_STATE_NEED_DATA to - * SRPT_STATE_DATA_IN ensures that srpt_xmit_response() will call this - * function a second time. + * the ib_srpt driver, change the state to the next state. */ spin_lock_irqsave(&ioctx->spinlock, flags); @@ -1279,25 +1276,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); @@ -1305,19 +1294,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(!transport_check_aborted_status(&ioctx->cmd, false)); break; case SRPT_STATE_NEED_DATA: - /* DMA_TO_DEVICE (write) - RDMA read error. */ - - /* XXX(hch): this is a horrible layering violation.. */ - spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags); - ioctx->cmd.transport_state &= ~CMD_T_ACTIVE; - spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags); + 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: /* @@ -1325,18 +1311,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; } @@ -1376,9 +1360,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); } } @@ -1721,15 +1710,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); @@ -1738,7 +1722,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) {