From patchwork Tue Oct 27 22:02:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 7504321 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 D81EF9F327 for ; Tue, 27 Oct 2015 22:02:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6A80209CE for ; Tue, 27 Oct 2015 22:02:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE0AC209CC for ; Tue, 27 Oct 2015 22:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753333AbbJ0WCv (ORCPT ); Tue, 27 Oct 2015 18:02:51 -0400 Received: from mail-by2on0072.outbound.protection.outlook.com ([207.46.100.72]:13359 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752747AbbJ0WCr (ORCPT ); Tue, 27 Oct 2015 18:02:47 -0400 Received: from BN1PR02CA0021.namprd02.prod.outlook.com (10.141.56.21) by BY1PR02MB1259.namprd02.prod.outlook.com (10.162.109.13) with Microsoft SMTP Server (TLS) id 15.1.306.13; Tue, 27 Oct 2015 22:02:46 +0000 Received: from BY2FFO11FD043.protection.gbl (2a01:111:f400:7c0c::136) by BN1PR02CA0021.outlook.office365.com (2a01:111:e400:2a::21) with Microsoft SMTP Server (TLS) id 15.1.312.18 via Frontend Transport; Tue, 27 Oct 2015 22:02:45 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; profitbricks.com; dkim=none (message not signed) header.d=none;profitbricks.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 BY2FFO11FD043.mail.protection.outlook.com (10.1.14.228) with Microsoft SMTP Server id 15.1.306.13 via Frontend Transport; Tue, 27 Oct 2015 22:02:45 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id 18.5C.04667.584FF265; Tue, 27 Oct 2015 15:02:45 -0700 (PDT) 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, 27 Oct 2015 15:02:45 -0700 X-AuditID: ac160a68-f790b6d00000123b-9a-562ff4859053 Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id C9.59.04661.584FF265; Tue, 27 Oct 2015 15:02:45 -0700 (PDT) Subject: [PATCH 4/7] IB/srp: Fix a potential queue overflow in an error path To: Doug Ledford References: <562FF404.7000504@sandisk.com> CC: Sagi Grimberg , Sebastian Parschauer , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <562FF484.6030400@sandisk.com> Date: Tue, 27 Oct 2015 15:02:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <562FF404.7000504@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRoxnkW7rF/0wg1+LRSxenv/AavHsUC+L xevjT5ksTt7md2DxmD5jE6vHnz+fmT3e77vK5vF5k1wASxSXTUpqTmZZapG+XQJXRtOzJvaC zzIVL1b+Ymxg/CnWxcjJISFgIvH3+AxGCFtM4sK99WwgtpDACU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qaZOkBVx3zrbHvc94VZj+8MH1ffcS9RwmhG/xThRZ tSxiaeDEGPHoh7vEv05OTFp/2u7or3WfUtib70tOMm1e57+mv3HR1N/FrTOiszb8mlKYXWXR uDOrKeg3v/jZvM7GGt7+0NbJ21dXvUlMPhl4a+qEsAYlluKMREMt5qLiRAC6/p5CAgIAAA== X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD043; 1:27O1F6o6Jsgdq7i/DAWR2QOb2ykoWJwXJTe3hys3nI7bpprQ9jCZ3fwpx/WGkE3JK6h6aii9KcHa3rwtOmtn1UUU7PB2b4Fgadox2pIo2lCRYfuTpC1v0Y0KrtdGs2l4ZsXrADXa4fzHPmGAVmxuCD95YTTXXTEBYB4tJoJgj790OGe3d6QnfRZuWD1qG8nUhss4YFrC+X51GslAt8XmnQh9NiHIdCdqNykqG5t2dD+gsiX/6ZpncaGp2eISorwMAa0k3S36dzk+g5JJT6wj7wAkhMYvQ0g2lXZkBTGslFt3lHswEKtyZcp+wZaxNeuHdn2HnBq+Z/CgDSZC03d2OENlCcsxDdS4q0OQ0N8JYVNkV9unXxssopRmdm46gbjKk1mCjfOpZNc1G1VIToaP/g== X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(19580405001)(229853001)(54356999)(77096005)(76176999)(87266999)(23676002)(65816999)(5001960100002)(83506001)(87936001)(110136002)(106466001)(189998001)(5008740100001)(50986999)(11100500001)(50466002)(5007970100001)(2950100001)(4001350100001)(33656002)(92566002)(97736004)(5001920100001)(86362001)(19580395003)(81156007)(64126003)(65806001)(65956001)(36756003)(69596002)(59896002)(80316001)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR02MB1259; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1259; 2:OHOEYWvihAFQQAX/b0eRZcI0PoRPK6gAXP5oh3bEEFf3zqFeyU7yslRtFwJErmS5SE5JCa73qCWdY1JqVb3GGm0aB2okEfKR9JNEywWL55qjiEQZF6bYFN96liTrx9tf5PQ/RJijeYcXgQu/yqYWglXjUFMOdoB93OW2T7ekwBw=; 3:MW6LzSlEcAv4ukIepn8ducy2gaPP3i6jNRHfaVC3dSK4rXLI6y+bG77IBbQ39y9icw2IqtWI3OMHkKR5DgXc6USQv4xRc28A3XAWrrRe1bunzXrYe5XArj/XjSjA590CATil1YdWsSwighfTWz+XG4Zi7nIT8YSXW1q8PMz4yCX5CqYXPEPhCIIKkqOvn4piYJK/7XHJExm/w6r2Klz3RtmjTV+HYYzaM+rbrChQYV5pE0WNujdwl/RQV0mVusOhslsXEh0siIKV0TIt2bOjxA==; 25:E7vc71Ef8KH3djXP3gmZytj72CwR/qlZ4mIKYCINoyxh2Xxc1oWWDmwzvSrQ15uQtLCe/6ubZwzL38Srg7ThvfAE0rQBLQdipoSpvC0zMTqoLm/IPfrIeVPSsF9QDXqzsMtqNF25RJBfF1irCU+1Efu1Yh4dx6lxiO3ZSrDUBMNWh4oBzvIsNCEiFbkadxEEHMEAS13MOwrputjYd69cJsoAnCpuAidT2PGF9ES8j/4ctLQUB9Cw41GGf7Cy0oKnD4fDuKpeuHe+CfCy26oVhg== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BY1PR02MB1259; X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1259; 20:YMgoiQUWr4ivMUzR6TYWl3hS9Yrw9U/A6EcvVcj/Bob0pWwu/drU6prY/PEfCIAzHBOwFhNyqyzf5PQ5t1ZcCH5Q7tnDizJmvx/meHuEc0coMjylDtkc7hqxvfUTL2xHk1SNB01zcTJXKZtCziRSFcr5cJ6hHtZcn7Lg+myQpVlsNLO3AK7DosXIOig+h1ctuEOrFXulFbU82AJL9oDsFXklkXuRU2VR70FtzboLZPG3tSsgu/SSaWMkSUrzHiCx6OZKE7cERaxw2cYFJiFNEiVdE2mIBlbX27ACst3ysIftnOrQM4w8Q8zsXLW5+5g08sumrbJdjQSZO5mm9TN9aKolj7N6OGbCJLX+ZLzTuecL2lY6WMCo6fu/MqAGF64UeVk+6678/UHd4PpIBgEi6fSiCIViDL25NNr4iIF5OjHEg9+TazAWjEaIsvkO+s0KcpkGdfxhiJmQCyQ5AhEYw6UvFIlfPKuZ3E5ujsnVyyoixg/teoZOp2MUTg16r0Op; 4:wAirUWGM6GyxrkaXUWiBIkHebcLg5Uc66PR8MH2bt6POEhA6RBQPZhkvQbuXFTRjH+MlxWC0TrOA0HlUtlv5twV97yh5NjV68Qb4y1HTMJpEL+sbX9Q90atG6BDSaR1PzAWt4uRdJ4ShbEr7p23qjyAKHOfEK75BBoLKUl0Ybys+PMRG2iK6dPZbAvf0L3pg+CvN+0w0kad1dAisE9JRLdAPCoicw7XOA9NptH/HmS0YflldUV6CoyyO3lS0zt7spAatW4Ivi3Xna8hL7u8s47yw/Roj7BEBFnt3gbSVOj4tDR79s99Mil6ytwh1hpxCC8kO0Y3KoeysoXDKEm7TjMbCnfZQObzb+8u//a3uXtt0yoDImYJoYbq0CNV6Ux/o X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(34787635062028)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(102215026); SRVR:BY1PR02MB1259; BCL:0; PCL:0; RULEID:; SRVR:BY1PR02MB1259; X-Forefront-PRVS: 0742443479 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTFQUjAyTUIxMjU5OzIzOnhlK1dTTVlHNUZFbk5iQXdzV1BtRHhqNXJk?= =?utf-8?B?dEJMN2ZzMm54b3VoUG9yMm9kYnBYWGc3YURZNTcxRGNlRnpiMDRlWERUOTNq?= =?utf-8?B?Zk1Kc0Q1ekhPRGFoU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Ch45aNZ7o0a7n1K5JDk1AK6U4xjKZGNunTpDrgKbX9QDQ30Ywj3e+aCSHvfUhxXIyPBJo4TNxDU4/UoJNkGqvLSSei57Vx5 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2015 22:02:45.4558 (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: BY1PR02MB1259 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Wait until memory registration has finished in the srp_queuecommand() error path before invalidating memory regions to avoid a send queue overflow. Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer --- drivers/infiniband/ulp/srp/ib_srp.c | 41 ++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 1aa9a4c..6d17fe2 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1044,7 +1044,7 @@ static int srp_connect_ch(struct srp_rdma_ch *ch, bool multich) } } -static int srp_inv_rkey(struct srp_rdma_ch *ch, u32 rkey) +static int srp_inv_rkey(struct srp_rdma_ch *ch, u32 rkey, u32 send_flags) { struct ib_send_wr *bad_wr; struct ib_send_wr wr = { @@ -1052,16 +1052,32 @@ static int srp_inv_rkey(struct srp_rdma_ch *ch, u32 rkey) .wr_id = LOCAL_INV_WR_ID, .next = NULL, .num_sge = 0, - .send_flags = 0, + .send_flags = send_flags, .ex.invalidate_rkey = rkey, }; return ib_post_send(ch->qp, &wr, &bad_wr); } +static bool srp_wait_until_done(struct srp_rdma_ch *ch, int i, long timeout) +{ + WARN_ON_ONCE(timeout <= 0); + + for ( ; i > 0; i--) { + spin_lock_irq(&ch->lock); + srp_send_completion(ch->send_cq, ch); + spin_unlock_irq(&ch->lock); + + if (wait_for_completion_timeout(&ch->done, timeout) > 0) + return true; + } + return false; +} + static void srp_unmap_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, - struct srp_request *req) + struct srp_request *req, + bool wait_for_first_unmap) { struct srp_target_port *target = ch->target; struct srp_device *dev = target->srp_host->srp_dev; @@ -1077,13 +1093,19 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd, struct srp_fr_desc **pfr; for (i = req->nmdesc, pfr = req->fr_list; i > 0; i--, pfr++) { - res = srp_inv_rkey(ch, (*pfr)->mr->rkey); + res = srp_inv_rkey(ch, (*pfr)->mr->rkey, + wait_for_first_unmap ? + IB_SEND_SIGNALED : 0); if (res < 0) { shost_printk(KERN_ERR, target->scsi_host, PFX "Queueing INV WR for rkey %#x failed (%d)\n", (*pfr)->mr->rkey, res); queue_work(system_long_wq, &target->tl_err_work); + } else if (wait_for_first_unmap) { + wait_for_first_unmap = false; + WARN_ON_ONCE(!srp_wait_until_done(ch, 10, + msecs_to_jiffies(100))); } } if (req->nmdesc) @@ -1144,7 +1166,7 @@ static void srp_free_req(struct srp_rdma_ch *ch, struct srp_request *req, { unsigned long flags; - srp_unmap_data(scmnd, ch, req); + srp_unmap_data(scmnd, ch, req, false); spin_lock_irqsave(&ch->lock, flags); ch->req_lim += req_lim_delta; @@ -1982,7 +2004,12 @@ static void srp_send_completion(struct ib_cq *cq, void *ch_ptr) struct srp_iu *iu; while (ib_poll_cq(cq, 1, &wc) > 0) { - if (likely(wc.status == IB_WC_SUCCESS)) { + if (unlikely(wc.wr_id == LOCAL_INV_WR_ID)) { + complete(&ch->done); + if (wc.status != IB_WC_SUCCESS) + srp_handle_qp_err(wc.wr_id, wc.status, true, + ch); + } else if (likely(wc.status == IB_WC_SUCCESS)) { iu = (struct srp_iu *) (uintptr_t) wc.wr_id; list_add(&iu->list, &ch->free_tx); } else { @@ -2084,7 +2111,7 @@ unlock_rport: return ret; err_unmap: - srp_unmap_data(scmnd, ch, req); + srp_unmap_data(scmnd, ch, req, true); err_iu: srp_put_tx_iu(ch, iu, SRP_IU_CMD);