nvme-rdma: don't complete requests before a send work request has completed
authorSagi Grimberg <sagi@grimberg.me>
Thu, 23 Nov 2017 15:35:22 +0000 (17:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Feb 2018 16:39:02 +0000 (17:39 +0100)
commitdd45c5e5be071fb9fee6e5f82fed6e0bf67737d5
treeb44788a2046384caed7ea811b2d6c390e1bf1563
parent120c41af36df87401576f09498abf5696fb3d474
nvme-rdma: don't complete requests before a send work request has completed

[ Upstream commit 4af7f7ff92a42b6c713293c99e7982bcfcf51a70 ]

In order to guarantee that the HCA will never get an access violation
(either from invalidated rkey or from iommu) when retrying a send
operation we must complete a request only when both send completion and
the nvme cqe has arrived. We need to set the send/recv completions flags
atomically because we might have more than a single context accessing the
request concurrently (one is cq irq-poll context and the other is
user-polling used in IOCB_HIPRI).

Only then we are safe to invalidate the rkey (if needed), unmap the host
buffers, and complete the IO.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/rdma.c