diff options
author | Raju Rangoju <rajur@chelsio.com> | 2016-08-29 17:15:49 +0530 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-09-02 13:46:32 -0400 |
commit | 63b268d232b869dfbc92e49c77f7e0648e1d039c (patch) | |
tree | aa246fc50f9bfe35472fa086ab3fa15b7b24f824 | |
parent | 6aaa382f1267644072f288916476879684502f73 (diff) |
IB/isert: Properly release resources on DEVICE_REMOVAL
When the low level driver exercises the hot unplug they would call
rdma_cm cma_remove_one which would fire DEVICE_REMOVAL event to all cma
consumers. Now, if consumer doesn't make sure they destroy all IB
objects created on that IB device instance prior to finalizing all
processing of DEVICE_REMOVAL callback, rdma_cm will let the lld to
de-register with IB core and destroy the IB device instance. And if the
consumer calls (say) ib_dereg_mr(), it will crash since that dev object
is NULL.
In the current implementation, iser-target just initiates the cleanup
and returns from DEVICE_REMOVAL callback. This deferred work creates a
race between iser-target cleaning IB objects(say MR) and lld destroying
IB device instance.
This patch includes the following fixes
-> make sure that consumer frees all IB objects associated with device
instance
-> return non-zero from the callback to destroy the rdma_cm id
Signed-off-by: Raju Rangoju <rajur@chelsio.com>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>