]> asedeno.scripts.mit.edu Git - linux.git/commit
xprtrdma: Fix list corruption / DMAR errors during MR recovery
authorChuck Lever <chuck.lever@oracle.com>
Tue, 1 May 2018 15:37:14 +0000 (11:37 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 1 May 2018 17:29:43 +0000 (13:29 -0400)
commit054f155721d7af1f343ed52bea246626d8450ca8
tree9ab5642f2453d5f73b8603a6cf2059803c715d23
parent98de9ce6f6660d02aa72d7b9b17696fa68a2ed9b
xprtrdma: Fix list corruption / DMAR errors during MR recovery

The ro_release_mr methods check whether mr->mr_list is empty.
Therefore, be sure to always use list_del_init when removing an MR
linked into a list using that field. Otherwise, when recovering from
transport failures or device removal, list corruption can result, or
MRs can get mapped or unmapped an odd number of times, resulting in
IOMMU-related failures.

In general this fix is appropriate back to v4.8. However, code
changes since then make it impossible to apply this patch directly
to stable kernels. The fix would have to be applied by hand or
reworked for kernels earlier than v4.16.

Backport guidance -- there are several cases:
- When creating an MR, initialize mr_list so that using list_empty
  on an as-yet-unused MR is safe.
- When an MR is being handled by the remote invalidation path,
  ensure that mr_list is reinitialized when it is removed from
  rl_registered.
- When an MR is being handled by rpcrdma_destroy_mrs, it is removed
  from mr_all, but it may still be on an rl_registered list. In
  that case, the MR needs to be removed from that list before being
  released.
- Other cases are covered by using list_del_init in rpcrdma_mr_pop.

Fixes: 9d6b04097882 ('xprtrdma: Place registered MWs on a ... ')
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/fmr_ops.c
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h