Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH v4 4/4] nvme-rdma: Check remotely invalidated rkey matches our expected rkey
Date: Mon, 20 Nov 2017 13:31:01 +0200	[thread overview]
Message-ID: <20171120113101.8292-5-sagi@grimberg.me> (raw)
In-Reply-To: <20171120113101.8292-1-sagi@grimberg.me>

If we got a remote invalidation on a bogus rkey, this is a protocol
error. fail if it happened.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 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);
-- 
2.14.1

  parent reply	other threads:[~2017-11-20 11:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 11:30 [PATCH v4 0/4] Fix request completion holes Sagi Grimberg
2017-11-20 11:30 ` [PATCH v4 1/4] nvme-rdma: don't suppress send completions Sagi Grimberg
2017-11-22 15:37   ` Max Gurtovoy
2017-11-20 11:30 ` [PATCH v4 2/4] nvme-rdma: don't complete requests before a send work request has completed Sagi Grimberg
2017-11-22 16:06   ` Max Gurtovoy
2017-11-20 11:31 ` [PATCH v4 3/4] nvme-rdma: wait for local invalidation before completing a request Sagi Grimberg
2017-11-22 16:45   ` Max Gurtovoy
2017-11-20 11:31 ` Sagi Grimberg [this message]
2017-11-21 13:18 ` [PATCH v4 0/4] Fix request completion holes Christoph Hellwig
2017-11-22 11:28   ` Sagi Grimberg
2017-11-22 11:37     ` Max Gurtovoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171120113101.8292-5-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox