From patchwork Tue Jan 5 14:27: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: 7955411 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 09F489F38D for ; Tue, 5 Jan 2016 14:27:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F3C02037F for ; Tue, 5 Jan 2016 14:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 237C92037E for ; Tue, 5 Jan 2016 14:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbcAEO1W (ORCPT ); Tue, 5 Jan 2016 09:27:22 -0500 Received: from mail-bn1bon0057.outbound.protection.outlook.com ([157.56.111.57]:51726 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751445AbcAEO1U (ORCPT ); Tue, 5 Jan 2016 09:27:20 -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=cve394XTtVAbABVX/AtAB4o5af9UYhEusCrefgGUCLc=; b=QjIanAq9ayJS5JNm+B+7QT5UsqQK6uZXrYPm9mV45hD8pOaERPPv5zXf61awcwZg6YPqAq/De+YIYlON6aD0EgG6MCJFZ/XGyT0LAfQZB/JoMtUPwrLqPgHSoeM0wHTCH7TlJW8VoXecj8+xhPU6r1j/rTeLCLyUgQhrYkBd6gM= Received: from BY2PR02CA0105.namprd02.prod.outlook.com (10.163.44.159) by BL2PR02MB292.namprd02.prod.outlook.com (10.141.90.149) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 14:27:17 +0000 Received: from BY2FFO11OLC016.protection.gbl (2a01:111:f400:7c0c::163) by BY2PR02CA0105.outlook.office365.com (2a01:111:e400:5261::31) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 14:27:17 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) 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.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 BY2FFO11OLC016.mail.protection.outlook.com (10.1.15.61) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 14:27:16 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id A9.1E.02821.4C2DB865; Tue, 5 Jan 2016 06:27:16 -0800 (PST) Received: from milsmgip12.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; Tue, 5 Jan 2016 06:27:16 -0800 X-AuditID: ac160a69-f797e6d000000b05-31-568bd2c4f7b5 Received: from [10.50.231.71] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id 00.FE.20697.3C2DB865; Tue, 5 Jan 2016 06:27:16 -0800 (PST) Subject: [PATCH 14/15] IB/srpt: Fix srpt_write_pending() To: Doug Ledford References: <568BD0FC.70207@sandisk.com> CC: Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <568BD2C2.6090808@sandisk.com> Date: Tue, 5 Jan 2016 15:27:14 +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+NgFnrHLMWRmVeSWpSXmKPExsWyRoxnke6RS91hBo9mK1m8PP+B1WLl6qNM Fs8O9bI4MHvsvtnA5vF+31U2j8+b5AKYo7hsUlJzMstSi/TtErgy5j5Yw1rwiK/i/YqvjA2M K3i6GDk5JARMJN7t7mSFsMUkLtxbz9bFyMUhJHCCUeL3+S2MEM52Rold378zwnTMnL8Cqmoz o8TehlVg7cICFhL/J50AKxIRUJPY9GoRexcjB1CRhsS7rVkgYWaBeIl1n96AlbAJGEl8ez+T BcTmFdCSOP6hhwnEZhFQkTjz+S8biC0qECHxY8MSRogaQYmTM5+A1XMKaEr8b90FNp4ZyF6/ Sx9ivLzE9rdzmEFOkxBYxipx+slnZpCEkIC6xMkl85kmMIrMQjJqFkL7LCTtCxiZVzGK5Wbm FOempxYYGukVJ+alZBZn6yXn525iBMcCV+YOxhWTzA8xCnAwKvHwcrzsChNiTSwrrsw9xCjB wawkwvv6SHeYEG9KYmVValF+fFFpTmrxIUZpDhYlcV7rFrUwIYH0xJLU7NTUgtQimCwTB6dU A6Nhc0/pVwbeuMc/Luo84/XMeVtx5nrTp49+fypyOVVssl97zn/D1C9x7Vdd0r+dYnUZ5815 WBgeW7KVZ6Y88Ti5//XsjZ/udXWpFt9QvF4SFmO4b/+aSO0c+V8d2qeSA29nvmu2yfDO2X3m xWWe31wFTiYF0k3bF5VaZMgr8j7fVaAx60nTGiWW4oxEQy3mouJEAB6b5ySBAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsXCtZEjRffIpe4wg82/RS1env/AarFy9VEm i2eHelkcmD1232xg83i/7yqbx+dNcgHMUVw2Kak5mWWpRfp2CVwZcx+sYS14xFfxfsVXxgbG FTxdjJwcEgImEjPnr2CDsMUkLtxbD2RzcQgJbGSUWHb5HxNIQljAQuL/pBOMILaIgJrEpleL 2LsYOYCKNCTebc0CMZkF4iXudoJVswkYSXx7P5MFxOYV0JI4/qEHLM4ioCJx5vNfsFWiAhES PzYsYYSoEZQ4OfMJWD2ngKbE/9Zd7CA2s4C6xJ95l5ghbHmJ7W/nME9g5J+FpGUWkrJZSMoW MDKvYhTLzcwpzk3PLDA00itOzEvJLM7WS87P3cQIDkfOqB2M1yeaH2Jk4uCUamDsEmPbOmXf SafXgSXca7b+uHk3cvKzpeoLFkx9dWtnWGa95FaT3PbSVWuYdJs2OGdPi7r+Inyde9slbltv 2dQfxXbrWDZW75ucHnP4xXYHsUfalY/Mpyxcx31mnbLBEo9LU6Zy6vzYeS3/6um132uFnpuw qE3VuaoQohMgmi/94+ZXb2Yt3rbZSizFGYmGWsxFxYkAMeivsfcBAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC016; 1:9FuPHXjFBJW71mAr4CFK+C609QfEdu//6S6WOwVznK2WWK9H108R2ypIiL39YIq3gK6ewn/AChWLrpNb5Dvx2PsWpMiWmm0N3gUFolmCUWTdy1Qm6BLjy6ygLvhhtZC44AucfknYbHU/G/oH8Ijo8cl2M4xRsEsmPaQURl7uj2IEG4QeKnYCrfVNtHymvwkc98252tYaIDreKxsAZ3R2Mvu1sQIZJW3tqLn40cPHpsBau837BTsVlDrPdvNWHzJptDBKOhfujhTT/S+XU0SVHR1HKNZjPoLZuPt+YDXucNVzy8qZeegobWRgJGs3LU9UpXGK8U46FLjui33lI6RbQw== X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(52314003)(199003)(76176999)(229853001)(80316001)(11100500001)(83506001)(69596002)(19580405001)(87936001)(19580395003)(50986999)(86362001)(54356999)(33656002)(50466002)(65816999)(87266999)(23676002)(65806001)(64126003)(5001960100002)(2950100001)(36756003)(65956001)(189998001)(4326007)(81156007)(5008740100001)(77096005)(230700001)(106466001)(110136002)(1096002)(97736004)(1220700001)(4001350100001)(59896002)(92566002)(586003)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB292; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB292; 2:CAveJVS5JIVMkL5epjAQgcc1VhsUUA1SR7sfq4DtNJwB0uaTua0LSnSdHNL3oiFVDH1bqN0p4LjxaJUrW1K9xGKVuVWUFed3t7xxFiSEokDFtw01Qoh6ypMaPCnls4lbSJGlBUPqYkmWP49glVbqKw==; 3:V/xp1JF9BaQwi5IdOTpeW8RRXvpcL2ycIBqMVR56YbOgt62A5P6B9YLpAte3WoP21W5QubuyKNdC191rjXXn/5aonTvxqhGA5CRgJiIf2sdJliQ68f0byYb++UI7caTOWlUZwrtAa4j78njS08CAxccchEWhlLDdSDZD/fhL9SHKRObzxdUj4iEV126mjNHyvFVyGHDgnNd8LmDztkcnOn27P0t04mbsqchxSEhJf+CPHpAJrIfLBHjQEEkEikZx+27Ai9J8sa0DSZ0ECpw+kQ==; 25:qmeGwjvija2jQ9osXHVS49fbIeCnQb8mjpGnnlduUI4WtTUobyaSbte7pUmk2tJzm2mvSoDzBLbebRBRK3Kx4jYr1EKr/f2tjQCWKyP7g9eiDqOXDTGcadcN8gGwBzoN+0UcfW2NF/2b/CpB35Jalo8Xmn2FGZ4u/Mwx4JdOlwOfqyTboT74B5al3pPCPwd5o2nF2siap1BN572BwCAhg/i5QnHkhwUPKI2BqOl/BI1IfGihrVzEn1TMiU9q0S9cLrLLD5BNzNwZjZnXaa/o1g== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2PR02MB292; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB292; 20:xcH5VJIPIkQBzvUtLN+aPNpMexhNIsEJDU4xvBcBEv642ua9gSoYFB0IEVnlDrvxaweEmUH6MBhrw3SVcpSOP3eHa08hurmGSDQHku7AFzZ0INhD3Ok8vYPRCLBg+eW5bKUEwHiKulkyr9bVKkVbjs+8pr9SMIgKM35aMVKgyBrIZtkabCEhgG8dGi/UUctap+qRg2gcVzDdFqY0aGiB2bQJxMViOQeQgrUZJsjuh7pwYbgCkdHMSnJ1mAKcXrSwOmbyLNPEINPhDmUzhD+PRNY6Z+WSMukdSFvL9k/RP8QFP0EfEzk/l5NWg4VF7y5UASXq0cw1AQTXmyhzYddy1x9Egdhmgfia8mv1v4siPYAxlRpQTNyCe8B4kJ0WSpqbFpHUhftIL0Q/GT0wdjR+TRZ1qsYamer/n6VpCT7Aw49wOme1HkfJJon+aej67HB1ZHvycJ0ShvJPg0RNz0MuLp2eGZBo+2Gm/ZooOuRr8ZNRESuztJAgu8IgyHliNAdI; 4:CPMwWCweQLxqDTEvZwdX9lLyWdWmPDbg6EPvC+lLD1STYpizhLux/rIWzzNj2ERnnxyRdRWSdNIhyM/H1+CE1eBrem1kDWMJT04quiGV+dC/REe2GMN6N/+hYH83GqB1pKpz3jXZA36afzoNx8S3UZgOZKnZNibjbJT18HlEUwflfUWLYL4eniyzKYS8rZ+fHDCEHnk51O24MevXaYq5gAsJgsV6N2Rrp/LvDV2qpdP5tS+xFQOVMoV2ftcDSMzSRwfLTV6D5/FwDibCXoVwD7ej0yDVIhSXI/wAOlOYXdiTeJYoqyQAGKZLi2hEOfJ6/RsZGUxN9fzMDVeynbEXp98bQOu1zqCaRITePCPzPk6b7n3Wp22IJKoENlzPPYYRPeXtUxeaFy96LB4epKwpGfvL2MyVVIUuhg8PNtF xNcJauVxgjUJtE/Gl9GPYH11q 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);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ACNxPKqXW+ZnfchwXab5/ryfxq/zmezKOfrkU6jQ==; 24:Qevda1MlTXAjdOEBCre44ORQHYFlkyfjDnTHRNwrloz6H4Eyz1fMXoTy38XTkeMMIqKkgsTYtY3ltIrUuFavDK392xIvex4rPUb1y+ehE/4=; 20:BRsMKnkrt0c4+tRjb9qGiGx9Qqf4rv4xcCBeIeHEp37rFEuafPcf3CP6Ks7i7oCpmF5/NkwIWm06THW7fqtI4lVHPjxf8c1Ot3/sFczNmUtRawvP/07Sx2cCcqdx7Vm5Xhvl9n+cBsKABufAqNnHCwzdkC4TE238f8XmVnu+TrDoNEFmLvwdQWKlY0MjaV4Uzqwa8nA8iKnQQa7+zmTsJ1NSjhUWYE7mPU9FlV+SkXHI+rZ2/6Et8DLD5h5IwUrE SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 14:27:16.7448 (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: BL2PR02MB292 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 The only allowed return values for the write_pending() callback function are 0, -EAGAIN and -ENOMEM. Since attempting to perform RDMA over a disconnecting channel will result in an IB error completion anyway, remove the code that checks the channel state from srpt_write_pending(). Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index cacb697..669ae5c 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2522,39 +2522,14 @@ out_unmap: */ static int srpt_write_pending(struct se_cmd *se_cmd) { - struct srpt_rdma_ch *ch; - struct srpt_send_ioctx *ioctx; + struct srpt_send_ioctx *ioctx = + container_of(se_cmd, struct srpt_send_ioctx, cmd); + struct srpt_rdma_ch *ch = ioctx->ch; enum srpt_command_state new_state; - int ret; - - ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); new_state = srpt_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA); WARN_ON(new_state == SRPT_STATE_DONE); - - ch = ioctx->ch; - BUG_ON(!ch); - - switch (ch->state) { - case CH_CONNECTING: - WARN(true, "unexpected channel state %d\n", ch->state); - ret = -EINVAL; - goto out; - case CH_LIVE: - break; - case CH_DISCONNECTING: - case CH_DRAINING: - case CH_DISCONNECTED: - pr_debug("cmd with tag %lld: channel disconnecting\n", - ioctx->cmd.tag); - srpt_set_cmd_state(ioctx, SRPT_STATE_DATA_IN); - ret = -EINVAL; - goto out; - } - ret = srpt_xfer_data(ch, ioctx); - -out: - return ret; + return srpt_xfer_data(ch, ioctx); } static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)