From patchwork Fri Apr 1 00:01:39 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: 8719251 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 4A7739F38C for ; Fri, 1 Apr 2016 00:01:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 16B4D2034E for ; Fri, 1 Apr 2016 00:01:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5259420303 for ; Fri, 1 Apr 2016 00:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843AbcDAABr (ORCPT ); Thu, 31 Mar 2016 20:01:47 -0400 Received: from mail-bn1bon0097.outbound.protection.outlook.com ([157.56.111.97]:6036 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752573AbcDAABp (ORCPT ); Thu, 31 Mar 2016 20:01:45 -0400 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=IJ4NMVKUbxiCUCMyKcTuxcn4bgiDMzKDtuG12Dd1RVs=; b=h4SuQhDddDZ/Sw7wkqaWqzWEFHqEnP0QdCBPfavGSkeoXJbYSzaHO9xL8Dyvou4mj8uOgPoZE9GFFc1BX9IDSskcUGjjrYEsL2E9z5YunaQrZ6QE4W7Blh/LoY+/zy1E4JQUWUTLgqCRsEblL61W2+n6ZvbX147sbdPHh7PpWeM= Received: from CY1PR0201CA0032.namprd02.prod.outlook.com (10.163.30.170) by CY1PR0201MB1516.namprd02.prod.outlook.com (10.163.139.19) with Microsoft SMTP Server (TLS) id 15.1.443.12; Fri, 1 Apr 2016 00:01:41 +0000 Received: from BL2FFO11FD056.protection.gbl (2a01:111:f400:7c09::179) by CY1PR0201CA0032.outlook.office365.com (2a01:111:e400:58b9::42) with Microsoft SMTP Server (TLS) id 15.1.447.15 via Frontend Transport; Fri, 1 Apr 2016 00:01:41 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) 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.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BL2FFO11FD056.mail.protection.outlook.com (10.173.161.184) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Fri, 1 Apr 2016 00:01:40 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id 80.F6.24357.B4ABDF65; Thu, 31 Mar 2016 17:01:15 -0700 (PDT) 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; Thu, 31 Mar 2016 17:01:40 -0700 X-AuditID: ac160c69-0ffff70000005f25-cf-56fdba4b97d8 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 1A.45.03935.36ABDF65; Thu, 31 Mar 2016 17:01:39 -0700 (PDT) To: Doug Ledford CC: "Nicholas A. Bellinger" , Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Subject: [PATCH for kernel v4.6] IB/srpt: Revert "Convert to percpu_ida tag allocation" Message-ID: <56FDBA63.7010804@sandisk.com> Date: Thu, 31 Mar 2016 17:01:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRmVeSWpSXmKPExsWyRoxnka73rr9hBvsOSlu8PP+B1WLl6qNM Fs8O9bJYtK0+w+jA4nF/+xEmj903G9g83u+7yubxeZNcAEsUl01Kak5mWWqRvl0CV8ajq4dY C6ZqV3x7/Zq5gbFDpYuRk0NCwETi97vvzF2MXBxCAgcYJW7f3cgI4exglHh7YCk7TNXjiyA2 SGIpo8TykzeYQRIiAmoSm14tAkswC/QxSpz784YNJMEmYCTx7f1MFhBbWCBS4nDTfLA4r4CW xIo9u8HiLAKqEv82LgLbICoQIdH64Ck7RI2gxMmZT4BqOICGakqs36UPEmYWkJfY/nYO2KkS ApNYJWau+sUEkhASUJc4uWQ+0wRGwVlI2mchtM9C0r6AkXkVo1huZk5xbnpqgaGpXnFiXkpm cbZecn7uJkZIaGfuYLz7xPsQowAHoxIPr8HMv2FCrIllxZW5hxglOJiVRHhf7wAK8aYkVlal FuXHF5XmpBYfYpTmYFES53W79yVMSCA9sSQ1OzW1ILUIJsvEwSnVwOgY2GvacuV9QHH23A/b Tiz3PS7vUBH2P7AqwfLfao8V1bP09hQ1WJwN8xMsfuCg63pt588rU6I/2r2S3nlOMK7V6OL5 ufz3VBfc12N9I3jXIvOIyLtX/Q/XBLH/EmPXNkgq6IywehHXd7k0Ui76ZN+P2Tanf5gGrHKs Wn1p/ZGgSrvMNeE1RUosxRmJhlrMRcWJANVQWMRpAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLJMWRmVeSWpSXmKPExsXCtZEjRTd5198wg7NbTC1env/AarFy9VEm i2eHelks2lafYXRg8bi//QiTx+6bDWwe7/ddZfP4vEkugCWKyyYlNSezLLVI3y6BK+PR1UOs BVO1K769fs3cwNih0sXIySEhYCLx+OJS9i5GLg4hgcWMEp3PpzCCJEQE1CQ2vVoElmAWmMAo cex8O1iCTcBI4tv7mSwgtrBApMThpvlsIDavgJbEij27weIsAqoS/zaCNHNyiApESLQ+eMoO USMocXLmE7AaZgF1iT/zLjFD2PIS29/OYZ7AyDMLSdksJGWzkJQtYGRexSiWm5lTnJueWWBo pFecmJeSWZytl5yfu4kRHGCcUTsYr080P8TIxMEp1cAYu7Rm15MfPWKPX67de/nwvc5ru8tm 9nr4yfhdzLSWD+Q+t0Msw+HzUS3eNw+Xrjmx9PGDfCbuP9/4TP5dSVt5IV3ti/bH9I7bITOj rapMw/MTKrmmXWyXy8iSTJnUGH9SLu56N7NuxXyFS0L/btx9/+OTxGY3QRVzvvku31LWfPMW 3HLsyw5jJZbijERDLeai4kQAMSUtU+ABAAA= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(51234002)(199003)(53416004)(33656002)(110136002)(54356999)(189998001)(65816999)(65806001)(47776003)(65956001)(50986999)(92566002)(19580405001)(87266999)(36756003)(4001350100001)(50466002)(87936001)(2270400002)(83506001)(5003600100002)(19580395003)(2906002)(586003)(106466001)(230700001)(1096002)(5008740100001)(4326007)(11100500001)(6806005)(86362001)(1220700001)(229853001)(23676002)(77096005)(81166005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB1516; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD056; 1:j1NigBNLwqaOQdSVBaH5yTqRaSVKWu6Yr9XcgIIsqmZDKNmZIf2ifpsKcIFzKVm2pJwIuHrpOlTjAO441lAj2qg4ypXVhjavu/Bm3gSsDYCeFNnX3otCyPwMzSXytgPHpkTErQPuLo7oC8uxxAW+JrGic60f7iRre9aenon7agAQOTzb5Ag+wOIFDOT4VWFoWhRA711mEQ5nSOK55f8O6CZoneeCoEocKFO2nHvrdPDKet3KzOrNHDiNXjzGa2AYlJLv15ZBW9XmEPnA5wcJCBYOyKcb3aB+mJlQzPxnFZI7ztes336hCndZQVqbS3uN3ed0XTEvI41fE59k4enEWMuz1IxOxVYB0EfJvXztlNViYJAe8ow0JUuRmaoefof7UOYoffhwLm1GSWZ8y2GbZyTYxjt3b/MZszPF5B15x7YHjCRdS7MD7OAGwkbMPqCW/BxXdFxpoTHVsifZS7+8rQ== X-MS-Office365-Filtering-Correlation-Id: 514c4149-e6b1-46e3-5730-08d359c0cde5 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1516; 2:KBgFQ9DrHcH7bnCFFDoVWlLrF6TLY7S2NeXtxjKHdEoNoyGOYccjubQbWUbs1Wt34t5+zADIBdoSI6Kvy9ZzKlCwQLpTLnoVHNO+Szqo42CK6Atb2BLOG3gT4AhxRwU02z4h9+lE7HemrWUfj71bvGqRNrAl7mbfhGunnxfmS6jTMmvipsoX0I9+PolYNaKx; 3:vOphjxCR9NDt9pCQY9UByRttJ21IEkIqGmB1zFa/bS2qvJXXPTDXews38kvNWF4rB3wJSufy5+7HUYxmiA/TAWBmLc0fyd4OWX80zbu82WhqK/vLbnlX8YBDfUXAFydTRBDm8q+T+hninAL1WpFSg/ETWh7ET3N5Sq8Su9VTd+R8QSLEirOYUWEXdLx5N08OuMJg4WrRDGakKjdykdTAKUXE69pGR3igIaSK2cMmgYZlUI/KTe9IPF7pU/74Pr+ZNqNV7VefaSoJmVSN+nHfEQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:CY1PR0201MB1516; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1516; 25:LvVOnhID2X1J30AtOYUqWcuV/OL+8OJ7XC3APAJs4v27jHS6DXholJ9iq386oYmxfYuxxSRGq0+cguvPF9pmo6TeklJN8pWvp8FwheGYnadpdBppGh4mZDOJr2MW/7jkCJGcHOtilAdD2XA3hvRutxRji+nWBtQ/N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ZzMs4eUes0WOSLKQgqPWJFYJ3uOQdmbDFB; 4:SDDUFEkG189X41VRxSmLLvtuxXi4cWeW3TgOutBMq2JwTprZwMbXwo+ZCRNGkHnQ97HUbqWm+rGg6KENE4yHZXOHf37eIkYHPAStLhNwybFyES0Vh0pWR30u4AmDJeaIbBVQ23uzvyA+DjL4atB1jFuBrxc7LeC62XIGbmHFOasDZj5JZHQmqYz0VfS9YUJbVrCbweXu7nzDq2pR14JWjtNsy7z05uh5sGYCeEgoOmF1FkXsJVlkwyEoIgYJtO/NuihJ+EPV6v5GPnmqUSIjix9tHv3hemv78neISNT2mMSCE1N4FTUNrLlHlv+jpg7Ot0bu8LxndSYI1oYFbCMVdmheZYffpcUefGC/K5ODeKUA6IfmfZCBMSwQnAdLvwEyGEj7bwQPmT4WKAFEYKpYDA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13016025)(8121501046)(5005006)(13018025)(3002001)(10201501046); SRVR:CY1PR0201MB1516; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB1516; X-Forefront-PRVS: 0899B47777 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyMDFNQjE1MTY7MjM6dEFRRzJxdHQxb2VnekxJVExOQXdqZU1t?= =?utf-8?B?TUNmVHBwTkhuSVE3TkxXZy9oMnpYVUJrc3RvdmJaU1lQU2poZ3RtVnJmZXh4?= =?utf-8?B?R2Y0cnFHQ0lvYXJ1cXcyTS93b2hqVXB6MUJDODNHemxFWHNyalA3eGQvY095?= =?utf-8?B?QzEzVmtEL3NqMnBjU1lEcnhHUlNuaVIvSGE2QjVxL0JpWndrUXlxQVpleFV0?= =?utf-8?B?Znl5a0R1dDhnbTJQWTYvNDE4TWNIRjFkRUNucjhJbmhZRVgrTmdCcit3TVpC?= =?utf-8?B?dTZnVUxDWnpqVEFXRFNrOEtTeFI1cVN4M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dZRDJXUGJBT3F6YWV0U3dweVh6NG9CbUZqeDlDUFlINytjOGtRL2NO?= =?utf-8?B?RDJYWG55bFNWdDd1WFhXM3BXZFdXSUtwOU9zM3EwK0hKZWVic3l4UHpHUUFj?= =?utf-8?B?c3dudFEwRTNIUnYya1R1YjhLRkE1VlBDSGFjaVYvYm1UV3UrK1ZtM2tkWXF4?= =?utf-8?B?MnZIeFNzQmxyWW9QQm5taHhuejVFUE80UDMxT3M3TjF3U2VBWFduVDJPTUFo?= =?utf-8?B?eVRrMjFtQWR1WWJEZ3gvM3FzQWlPK1NSTmR0UmxUcGFQQW83WlhTY1IrQW5J?= =?utf-8?B?WURvWFBRPT0=?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1516; 5:Y2t1cVXrDABeN38GLFr/xT3AOnjWbuFropPFnOAtyU8lziyQLS1gzCVRZqqYPZQ87LGNjuJUCmXt5JJ9qANEMjBzpPFo/VL2IdOff9rtqgEVv5nCBg8j35ro3wuKABJlkQyKjxg0EaitYCK3WJ+2cQ==; 24:BSCqOi09u6FTNLzh017PqWQ3uAQr+wjm36n1+J/frRsb8FhZ3NH646QXJJNyXX+qivE2kUpbQ+rnyxGDek/6x/m8Hf5zUS7Y2EoAVmFGZ3E=; 20:+6yS8LM/JB3r6v7RFxGsm+zTTkuKzDn2DjhWO+MveYYqpFTMNqPn0p3/+cW4hMJgDZiqyAYJMaVPeAULuSuLWLKWaFsffUnI/Raxt4pc+Q9EgHvihSu8guYXtPUBg59pfPidxyfShwzs/YwJMyf9vFYHm4e5wAPGsdVkNUNIiuqdS4zUGsHwNesxCY7GE40H3RFDfqD6Q5UVuZC10YpvQBSXu1IbMeyeNhW0ac1L7ZacTrSBEKp72+Wd2SwRoU6C SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2016 00:01:40.7956 (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.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB1516 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.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 That patch is wrong because it makes the ib_srpt driver use I/O contexts allocated by transport_alloc_session_tags() but it does not initialize these I/O contexts properly. All the initializations performed by srpt_alloc_ioctx() are skipped. Revert commit 0fd10721fe36 and thereby fix the following kernel crash: kernel BUG at drivers/infiniband/ulp/srpt/ib_srpt.c:1439! invalid opcode: 0000 [#1] SMP Workqueue: target_completion target_complete_ok_work [target_core_mod] RIP: 0010:[] [] srpt_queue_response+0x437/0x4a0 [ib_srpt] Call Trace: [] srpt_queue_data_in+0x9/0x10 [ib_srpt] [] target_complete_ok_work+0x152/0x2b0 [target_core_mod] [] process_one_work+0x197/0x480 [] worker_thread+0x49/0x490 [] kthread+0xea/0x100 [] ret_from_fork+0x22/0x40 Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Reviewed-by: Leon Romanovsky --- drivers/infiniband/ulp/srpt/ib_srpt.c | 55 ++++++++++++++++++++++++----------- drivers/infiniband/ulp/srpt/ib_srpt.h | 2 ++ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 13594db..3b425af 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1264,26 +1264,40 @@ free_mem: */ static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) { - struct se_session *se_sess; struct srpt_send_ioctx *ioctx; - int tag; + unsigned long flags; BUG_ON(!ch); - se_sess = ch->sess; - tag = percpu_ida_alloc(&se_sess->sess_tag_pool, TASK_RUNNING); - if (tag < 0) { - pr_err("Unable to obtain tag for srpt_send_ioctx\n"); - return NULL; + ioctx = NULL; + spin_lock_irqsave(&ch->spinlock, flags); + if (!list_empty(&ch->free_list)) { + ioctx = list_first_entry(&ch->free_list, + struct srpt_send_ioctx, free_list); + list_del(&ioctx->free_list); } - ioctx = &((struct srpt_send_ioctx *)se_sess->sess_cmd_map)[tag]; - memset(ioctx, 0, sizeof(struct srpt_send_ioctx)); - ioctx->ch = ch; + spin_unlock_irqrestore(&ch->spinlock, flags); + + if (!ioctx) + return ioctx; + + BUG_ON(ioctx->ch != ch); spin_lock_init(&ioctx->spinlock); ioctx->state = SRPT_STATE_NEW; + ioctx->n_rbuf = 0; + ioctx->rbufs = NULL; + ioctx->n_rdma = 0; + ioctx->n_rdma_wrs = 0; + ioctx->rdma_wrs = NULL; + ioctx->mapped_sg_count = 0; init_completion(&ioctx->tx_done); - - ioctx->cmd.map_tag = tag; + ioctx->queue_status_only = false; + /* + * transport_init_se_cmd() does not initialize all fields, so do it + * here. + */ + memset(&ioctx->cmd, 0, sizeof(ioctx->cmd)); + memset(&ioctx->sense_data, 0, sizeof(ioctx->sense_data)); return ioctx; } @@ -2013,7 +2027,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, struct ib_cm_rep_param *rep_param; struct srpt_rdma_ch *ch, *tmp_ch; u32 it_iu_len; - int ret = 0; + int i, ret = 0; unsigned char *p; WARN_ON_ONCE(irqs_disabled()); @@ -2135,6 +2149,12 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, if (!ch->ioctx_ring) goto free_ch; + INIT_LIST_HEAD(&ch->free_list); + for (i = 0; i < ch->rq_size; i++) { + ch->ioctx_ring[i]->ch = ch; + list_add_tail(&ch->ioctx_ring[i]->free_list, &ch->free_list); + } + ret = srpt_create_ch_ib(ch); if (ret) { rej->reason = cpu_to_be32( @@ -2165,8 +2185,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, p = &ch->sess_name[0]; try_again: - ch->sess = target_alloc_session(&sport->port_tpg_1, ch->rq_size, - sizeof(struct srpt_send_ioctx), + ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0, TARGET_PROT_NORMAL, p, ch, NULL); if (IS_ERR(ch->sess)) { pr_info("Rejected login because no ACL has been" @@ -2873,7 +2892,7 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) struct srpt_send_ioctx *ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); struct srpt_rdma_ch *ch = ioctx->ch; - struct se_session *se_sess = ch->sess; + unsigned long flags; WARN_ON(ioctx->state != SRPT_STATE_DONE); WARN_ON(ioctx->mapped_sg_count != 0); @@ -2884,7 +2903,9 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) ioctx->n_rbuf = 0; } - percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); + spin_lock_irqsave(&ch->spinlock, flags); + list_add(&ioctx->free_list, &ch->free_list); + spin_unlock_irqrestore(&ch->spinlock, flags); } /** diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index ca288f0..af9b8b5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -179,6 +179,7 @@ struct srpt_recv_ioctx { * struct srpt_send_ioctx - SRPT send I/O context. * @ioctx: See above. * @ch: Channel pointer. + * @free_list: Node in srpt_rdma_ch.free_list. * @n_rbuf: Number of data buffers in the received SRP command. * @rbufs: Pointer to SRP data buffer array. * @single_rbuf: SRP data buffer if the command has only a single buffer. @@ -201,6 +202,7 @@ struct srpt_send_ioctx { struct srp_direct_buf *rbufs; struct srp_direct_buf single_rbuf; struct scatterlist *sg; + struct list_head free_list; spinlock_t spinlock; enum srpt_command_state state; struct se_cmd cmd;