From patchwork Mon Nov 20 11:31:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 10066337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C128602B7 for ; Mon, 20 Nov 2017 11:31:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EE6B29053 for ; Mon, 20 Nov 2017 11:31:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8401D2926A; Mon, 20 Nov 2017 11:31:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D3A929053 for ; Mon, 20 Nov 2017 11:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751075AbdKTLbQ (ORCPT ); Mon, 20 Nov 2017 06:31:16 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46100 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdKTLbP (ORCPT ); Mon, 20 Nov 2017 06:31:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3stPazgvGT2LiA16tqQ21gDRJzqIFxDYye7gmq9rMYA=; b=Y858Z4B7DmSy8D/blSEWn1+eH SMrYDGmVVVjQFtdvcYWnEMlutYDQL98/8chyBiz9mGgXlMdZ/SWrRks2KZB+fiWxWtWmKTmiJ6z1R 3Ke9G3JaM8xDRxzGx2ZVqqeQcduogS7qFfVQIar78md71e6g1wQpeV4gMwnM0hstQSNPpf1VzhuGO bj+QY4j1v1oIMKq+U8rS3dFTh04q07ksGlkemmpuapfoAVas2c5YVVZhaQ5qZB3LcycKJcEDHQMsO V3nXH1sPjE3kNn1aA5X2oGy8RqEpHAo9FvjxlPcXupxh/FsTP/GMXAK4u3oEv170Lh0Zo77auPqCA B6hsVS8gg==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1eGkIE-0004cm-RM; Mon, 20 Nov 2017 11:31:15 +0000 From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org Cc: Christoph Hellwig Subject: [PATCH v4 4/4] nvme-rdma: Check remotely invalidated rkey matches our expected rkey Date: Mon, 20 Nov 2017 13:31:01 +0200 Message-Id: <20171120113101.8292-5-sagi@grimberg.me> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171120113101.8292-1-sagi@grimberg.me> References: <20171120113101.8292-1-sagi@grimberg.me> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we got a remote invalidation on a bogus rkey, this is a protocol error. fail if it happened. Signed-off-by: Sagi Grimberg --- drivers/nvme/host/rdma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 363dd1ca1a82..4ba58939bdc6 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1334,8 +1334,13 @@ static int nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue, req->status = cqe->status; req->result = cqe->result; - if ((wc->wc_flags & IB_WC_WITH_INVALIDATE) && - wc->ex.invalidate_rkey == req->mr->rkey) { + if (wc->wc_flags & IB_WC_WITH_INVALIDATE) { + if (unlikely(wc->ex.invalidate_rkey != req->mr->rkey)) { + dev_err(queue->ctrl->ctrl.device, + "Bogus remote invalidation for rkey %#x\n", + req->mr->rkey); + nvme_rdma_error_recovery(queue->ctrl); + } req->mr->need_inval = false; } else if (req->mr->need_inval) { ret = nvme_rdma_inv_rkey(queue, req);