xprtrdma: Fix DMAR failure in frwr_op_map() after reconnect
commitd3d9428d71333b0929c30e7d3feacac6306828d5
authorChuck Lever <chuck.lever@oracle.com>
Mon, 7 Nov 2016 21:16:24 +0000 (7 16:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:49 +0000 (18 10:51 +0100)
treebc4fd6eadff9ee5ff3615908c854adf93a35b7df
parent31c749bee3dee6c320134aa2fe957c767c9c3e55
xprtrdma: Fix DMAR failure in frwr_op_map() after reconnect

commit 62bdf94a2049822ef8c6d4b0e83cd9c3a1663ab4 upstream.

When a LOCALINV WR is flushed, the frmr is marked STALE, then
frwr_op_unmap_sync DMA-unmaps the frmr's SGL. These STALE frmrs
are then recovered when frwr_op_map hunts for an INVALID frmr to
use.

All other cases that need frmr recovery leave that SGL DMA-mapped.
The FRMR recovery path unconditionally DMA-unmaps the frmr's SGL.

To avoid DMA unmapping the SGL twice for flushed LOCAL_INV WRs,
alter the recovery logic (rather than the hot frwr_op_unmap_sync
path) to distinguish among these cases. This solution also takes
care of the case where multiple LOCAL_INV WRs are issued for the
same rpcrdma_req, some complete successfully, but some are flushed.

Reported-by: Vasco Steinmetz <linux@kyberraum.net>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Vasco Steinmetz <linux@kyberraum.net>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/xprt_rdma.h