linux-stable/net/sunrpc/xprtrdma
Chuck Lever e89e8d8fcd xprtrdma: Fix BUG after a device removal
Michal Kalderon reports a BUG that occurs just after device removal:

[  169.112490] rpcrdma: removing device qedr0 for 192.168.110.146:20049
[  169.143909] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
[  169.181837] IP: rpcrdma_dma_unmap_regbuf+0xa/0x60 [rpcrdma]

The RPC/RDMA client transport attempts to allocate some resources
on demand. Registered buffers are one such resource. These are
allocated (or re-allocated) by xprt_rdma_allocate to hold RPC Call
and Reply messages. A hardware resource is associated with each of
these buffers, as they can be used for a Send or Receive Work
Request.

If a device is removed from under an NFS/RDMA mount, the transport
layer is responsible for releasing all hardware resources before
the device can be finally unplugged. A BUG results when the NFS
mount hasn't yet seen much activity: the transport tries to release
resources that haven't yet been allocated.

rpcrdma_free_regbuf() already checks for this case, so just move
that check to cover the DEVICE_REMOVAL case as well.

Reported-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Fixes: bebd031866 ("xprtrdma: Support unplugging an HCA ...")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2018-02-02 13:31:04 -05:00
..
backchannel.c xprtrdma: Correct some documenting comments 2018-01-23 09:44:39 -05:00
fmr_ops.c xprtrdma: Add trace points to instrument memory invalidation 2018-01-23 09:44:36 -05:00
frwr_ops.c xprtrdma: Add trace points to instrument memory invalidation 2018-01-23 09:44:36 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
module.c rpcrdma: infrastructure for static trace points in rpcrdma.ko 2018-01-23 09:44:25 -05:00
rpc_rdma.c xprtrdma: Fix calculation of ri_max_send_sges 2018-02-02 13:29:57 -05:00
svc_rdma.c svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt 2017-04-25 17:25:55 -04:00
svc_rdma_backchannel.c Lots of good bugfixes, including: 2017-11-18 11:22:04 -08:00
svc_rdma_recvfrom.c svcrdma: Properly compute .len and .buflen for received RPC Calls 2017-07-12 15:54:57 -04:00
svc_rdma_rw.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
svc_rdma_sendto.c svcrdma: fix an incorrect check on -E2BIG and -EINVAL 2017-07-13 14:18:47 -04:00
svc_rdma_transport.c svcrdma: Enqueue after setting XPT_CLOSE in completion handlers 2017-11-07 16:44:02 -05:00
transport.c SUNRPC: Trace xprt_timer events 2018-01-23 09:44:39 -05:00
verbs.c xprtrdma: Fix BUG after a device removal 2018-02-02 13:31:04 -05:00
xprt_rdma.h xprtrdma: Add trace points in the client-side backchannel code paths 2018-01-23 09:44:37 -05:00