From patchwork Wed Apr 6 18:56:41 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: 8764501 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 288279F372 for ; Wed, 6 Apr 2016 18:56:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 034F5201D3 for ; Wed, 6 Apr 2016 18:56:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93FCC201CD for ; Wed, 6 Apr 2016 18:56:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752267AbcDFS4t (ORCPT ); Wed, 6 Apr 2016 14:56:49 -0400 Received: from mail-by2on0057.outbound.protection.outlook.com ([207.46.100.57]:59680 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752058AbcDFS4r (ORCPT ); Wed, 6 Apr 2016 14:56:47 -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=4fQj+5mftlNrUAE30XkqrUv4anwhxZ85JD1AsDJW8jQ=; b=uS6mGuJoNpMf2+IVIkS43nyrgGDgoXTuLNcIjNQW3dnp9hSdiYoEZ2eBJ8trCradldTqEqogaBgB0maKTgcMdWdiqTVFNT9/r8ilJjOp84cLge2fDay3A1qgrFUuJn9gHHZU1LlUs4CH7g4XkUsvsZ2/RpYExwZdz2rXbycRWNk= Received: from BY2PR02CA0116.namprd02.prod.outlook.com (10.163.44.170) by SN1PR0201MB1870.namprd02.prod.outlook.com (10.163.76.142) with Microsoft SMTP Server (TLS) id 15.1.447.15; Wed, 6 Apr 2016 18:56:42 +0000 Received: from BY2FFO11FD011.protection.gbl (2a01:111:f400:7c0c::120) by BY2PR02CA0116.outlook.office365.com (2a01:111:e400:5261::42) with Microsoft SMTP Server (TLS) id 15.1.447.15 via Frontend Transport; Wed, 6 Apr 2016 18:56:42 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.org; 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 BY2FFO11FD011.mail.protection.outlook.com (10.1.14.129) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Wed, 6 Apr 2016 18:56:41 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [172.22.12.162]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 30.65.03047.0CB55075; Wed, 6 Apr 2016 11:56:00 -0700 (PDT) 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; Wed, 6 Apr 2016 11:56:41 -0700 X-AuditID: ac160c69-5f3ff70000000be7-6e-57055bc0ad3a Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id DC.E0.02566.8EB55075; Wed, 6 Apr 2016 11:56:40 -0700 (PDT) Subject: [PATCH 1/4] IB/srpt: Revert "Convert to percpu_ida tag allocation" To: Doug Ledford References: <57055BC6.7070402@sandisk.com> CC: "Nicholas A. Bellinger" , Christoph Hellwig , Sagi Grimberg , "linux-rdma@vger.kernel.org" , target-devel From: Bart Van Assche Message-ID: <57055BE9.1010403@sandisk.com> Date: Wed, 6 Apr 2016 11:56:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <57055BC6.7070402@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRmVeSWpSXmKPExsWyRoxnke6BaNZwg+avBhYvz39gtVi5+iiT xbNDvSwWbavPMFqse/2exaJ16VsmBzaP8/c2snjc336EyWP3zQY2j/f7rrJ5fN4kF8AaxWWT kpqTWZZapG+XwJXxq+kkY8EcvYpHX98wNzAeUuti5OSQEDCRmHLvNmMXIxeHkMBcJokZk14z QzjbGSX2nP8HlOEAq9r7KRekQUhgKVD8YQKILSzgLTG18QU7iC0ioCax6dUidogaLYnJ6/pZ QOYwC9xnlHizfAIzSIJNwEji2/uZLCA2L0jRxutgDSwCKhLHL78Di4sKREi0PnjKDlEjKHFy 5hOwOKeAtsTvrrdMIPcwC2hKrN+lDxJmFpCX2P52DtjNEgIHWSUW/ljFDHGEusTJJfOZJjAK z0IyahZC+ywk7QsYmVcxiuVm5hTnpqcWGJrqFSfmpWQWZ+sl5+duYoRESeYOxrtPvA8xCnAw KvHwClixhAuxJpYVV+YeYpTgYFYS4W2IYA0X4k1JrKxKLcqPLyrNSS0+xCjNwaIkzut270uY kEB6YklqdmpqQWoRTJaJg1OqgfHYLmHWY+1NYl+2PP3/uHB2yW8eWVOT66oqq10XXqyf5lk/ WWvi0sLUzAvi87JZVs6cud1VyrGpMVg9oqom3nK79vK0I/k53fz/pDX+OihutE8zSDJ8PEXX 5cJFhvuRyc6CveVPtsgxr2V6cebI/vDzL3YmFXEr+4uoTn7JMO2YswLfovpz85VYijMSDbWY i4oTARBVyfaOAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMJMWRmVeSWpSXmKPExsXCtZEjRfdFNGu4wdIea4uX5z+wWqxcfZTJ 4tmhXhaLttVnGC3WvX7PYtG69C2TA5vH+XsbWTzubz/C5LH7ZgObx/t9V9k8Pm+SC2CN4rJJ Sc3JLEst0rdL4Mr41XSSsWCOXsWjr2+YGxgPqXUxcnBICJhI7P2U28XIxSEksJhR4kljP3MX IyeHsIC3xNTGF+wgtoiAmsSmV4vAbCEBLYnJ6/pZQBqYBR4ySnzumsMEkmATMJL49n4mC4jN C1K08TpYA4uAisTxy+/A4qICERKtD56yQ9QISpyc+QQszimgLfG76y3YHGYBdYk/8y4xQ9jy EtvfzmGewMg3C0nLLCRls5CULWBkXsUolpuZU5ybnllgaKhXnJiXklmcrZecn7uJERysnJE7 GJ9OND/EyMTBKdXA2OAso5VqVXtC7SK7ZJbsY7d+Z2e7+MtCbC8KmoImWE45xb579W7eNBuH XbvD1My3Xni6IHFP2GoWuxUzuKrY3/Qein30T/jnz5IE8/M2/hLTz2x/FMx15nyB5jPrCLlk vjpOkePzdJMj5wl+jN0m9aL1THl8eVJ+obv9yZqwskkPvu5/Ki6lxFKckWioxVxUnAgAv8X+ BQYCAAA= 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)(51234002)(199003)(189002)(54356999)(110136002)(189998001)(1096002)(87936001)(99136001)(1220700001)(65816999)(5008740100001)(87266999)(50986999)(59896002)(106466001)(229853001)(76176999)(81166005)(77096005)(23676002)(83506001)(6806005)(4001350100001)(2906002)(586003)(65806001)(65956001)(86362001)(4326007)(2270400002)(19580405001)(2950100001)(50466002)(19580395003)(33656002)(5003600100002)(53416004)(230700001)(47776003)(92566002)(64126003)(80316001)(36756003)(11100500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0201MB1870; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD011; 1:HUvKs1U+ltYtW0YHNuJHs4qJxwdpqxq75+IUp6TANyYA5WP1/9CsSgx0Ll4Vw0H6vMHQVS7WO7TCpliBKYBOBRWSt+7sjJZuhJlUsPE3qM76f2lLowou//yD7A/ImgiUToTDDYMxVWkXc3BsGV6vIQ00sJ2LtT2We6hsefHaeEu1VeZCG+yDw4w7plx7RaGH9zcCRTfdN++lYLq8LbCx0QWMGgXp1NHKAsM9TGMdbYWunmoerWJZWrbvdTYJJNz/euEGxMZ6HMqH15KKdtmqiebB3KqmUiZrj0HeM5l9GshyA8OH4ANKnL1CbfBZDp1WdUKJXBprHlK8qu7Wca4UrcitN/ypXEb4hsAQHy07Zosdyg0JzLMR511LqUB7OvdDplBzFPpqmoj+/C8pD+Peb3Adk0NgVSIkB2MDV66YcMmSAaYHvLnwA5C63o5J1Lg+5gN9ad6QBjFnZXm0BqKTCj7wWmcGoOa+r7pPhwgyguE= X-MS-Office365-Filtering-Correlation-Id: c640abe3-f6d2-4ff3-afc1-08d35e4d30fd X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1870; 2:/bgcE6HF3+Ky3TugeSq4StAajMKEFisBjvqZ2jzAnFqjh/MY7L4ngfuCQ2yG0P3kp+JZbQt76fgG7BKNIH+6uWNrjV5jbcjPMtdf7HudxU9aem2njcSbSEleR7zkNjxp2RQaLO9v3mNfgLMbPCZ6hZOnDhvI3tIUdii4HLb8Ej4H/tm5ZZv0pzR/bLphQBh1; 3:g/fL7madEk+m5UXL33hMv9PKgDqu7guc1ezIM/PPUBwI5+Mer98YSf7olXdw0R3vUDTNRjlpv2EDwrsVvXcw4zCwfF5qw4jRqjf1yaams1YlwEZjnz+yq3F0pCptjexvjrQPdDhYEv4j42Ov+zo8fIcfbQyBxyrdhsseJ/fk804kACDAwyaxutGwDnAflk1iyYWwNscDBRKlYDhM502aSLIA5wtgP66udJIKxoZG2PKQCTq7gmAUNU91J9cVKjR8O+eXMmvyTkSVa+TW93UHxg== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:SN1PR0201MB1870; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1870; 25:/qoHpE+yvBquksFE3N1Qz+g5Td9gfWN2W215NQ/xj5SxylSlKUuZBRERwhnvdfJWfPvPQz5S48XypCo63wjug7vR9EaFiDf/T8YSaT0fRPdDF6PaHSxLZN37xuBgIcB5sFEwnvpKmUjR4Qktwo4hcdUkEbrKyCtLhpv0oVnDwir4Hn0tHXz58JlYTgtxRn1pEr6FwqaQZFwxxVnvabw46WQc7jQQmHR58dqZAKSd5p0jpFnk4uh2+FmC9uDPP/gMfzT0QxYGJlad+Onf1HLvcgR3kgWQpIep/H66nSm2PQNHQQMpVRz/ujaYpkojdt9XZdFUF+509BUdrrT7/B2gXLsjPHxOxARoMswmPX7eIzA5p9rPKcHiNBcqCjQi/KItIfureStUuOw+FpQGTqzwJRthQgW2XGusdUbWRiwG7CIfVPDuhXJrRQwJzh67j0XLC52dVMcRki5vqxFzOk7iAri4HPCVkZcIINlM1P6q3JEqz5bubd/L7JroAMU8hrPZlDjyZEUsprL32gStJKZRnbUZolBN1XkoyC9iEpjE+qSys+6no/PQAdLsftyciFSljU5HeTwGgL+0ECu6dEScKAsDQZG8g3uWkLF8L67boMbN49Ot1NVGr3+AetoWrct1UOPRCgu9iVOzHQtGPM/7cS1TIcHaPcB+Ct+eOBc1aeE= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1870; 20:346iEY0LLw32b4sPeHEwcusjKTj0hXIU1sBdH3SFBUzzLjpJcnBaiQOiKCuDheW3qxKZVQDag1zY2rV2z+E6sfio+xH9LcoPcQTdajDBnJSch25k1AxmCXjvIHTJwn9D7HlMGjlnCVdoKmz61NyaFKMx9mVCHKNz5ShBSYftzoM+D/jWukoudZKrSbK/QCD2sIopiPitz4g/215r0f/Jyp/1LtPqKGgH1t3qb8ulEqIt+bmyGw0H/sTSRZv6oT3i/oDutXJI5DJKP7zO2Hoq/UTLAcalo0RMxywiqvOzLp0JhHu6QVE9Tw30Ij6ZAPMbpvZRF9SYriM8gTddPOG/IAegJSCSmFI/Prw5ANFtv4hfSSBKoJM8Ta6FnX2YKw+C+deQdqXSjqT79DwduqCP6c42eTBUcLoLcCZYcfJavW/T0l6QxTHWyUbO1JzzlT7OjBRTfxhRO2q5iIV1+UNMV5ZymTCBLTVuebUJa1bZUX3IBCHY5zex5fDOtovTRFgg; 4:xiySOXZAw480LN1pdhGjtIiCupyQEv7CxR1ElZdiVN2lBd79RDlivRCHgGCZLB1LpqZ2fO+gh6cV7KG3TzzqUaPIl1ptH5evmnPobpCeCy4Ll6RV+VKQT3GAVmm1lpzlUMQLfdSvD5J/i/KIG2g4qfNDXpImFaORh9VtyfxZG9vHGRo2jsRkN4HTojYuYUaj100QcbIstaTzipTJJjIIKAPpENkF500jOORLngjMxPrUqT9IxWzCMcVr1HwC7Uht2yPi4bjA94eLNecHSErM//HEnPKZqrwOOclCuXCkNhClyrrG1I7s49NTeB6l+/1qrR92sWsUCQ9/U32w2IomgngbFwiJ8R99l92SaV8JCffVtfXBfwk0c4pgokNXREm2lUJbJD7YcU3FvhifO3UU8AAbhVNLwOy9yGAX 7Y9Npkg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(5005006)(8121501046)(13016025)(10201501046)(3002001); SRVR:SN1PR0201MB1870; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0201MB1870; X-Forefront-PRVS: 0904004ECB X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjAyMDFNQjE4NzA7MjM6Q3Z2WVhpTWFtUkVlT1dyWnFDVldmeHpo?= =?utf-8?B?SGlTd0UvRTBtSHZBdXd1S1U5RlQ2MExaeXBJUXNkQXk5RnpoeE1jQk1LVEdI?= =?utf-8?B?MVl4TDlTalh5NHYySkhpUjkwYXZTWTVCTzhEWktrSWxwT0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OCoeVc=; 20:MZgypiJpysebYCxktLsyrPFCvRaAWY873em+blwHYWPOPjklceOGJz/sYp4Wj69Dfcy2c09sAiHllAwLGuDE1+xo4cDqDilHRFcbwF3Va5HHQXCcl1HIl8t+ZcdqpZ1uPFMIBJTmCmxEgKaqx5xuPer7XsLk7BpUN5fYfm4X55T1s3AFzbGRFmWn8xJukHJ/JMqjW2RPHfKURCNMMm2OJQHTK2hvKnERVKJLnderfYcqnOwtAoyLhN3DIfMUpZv9 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2016 18:56:41.6172 (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: SN1PR0201MB1870 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 causes the ib_srpt driver to crash as soon as the first SCSI command is received. This means that that patch was untested. Hence revert it. The shortcomings of that patch are as follows: - 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. - The amount of memory that is needed for I/O contexts is doubled. - srpt_rdma_ch.free_list is no longer used but is not removed. 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 Cc: Christoph Hellwig Cc: Sagi Grimberg --- 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;