]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
IB/isert: Properly release resources on DEVICE_REMOVAL
authorRaju Rangoju <rajur@chelsio.com>
Mon, 29 Aug 2016 11:45:49 +0000 (17:15 +0530)
committerDoug Ledford <dledford@redhat.com>
Fri, 2 Sep 2016 17:46:32 +0000 (13:46 -0400)
commit63b268d232b869dfbc92e49c77f7e0648e1d039c
treeaa246fc50f9bfe35472fa086ab3fa15b7b24f824
parent6aaa382f1267644072f288916476879684502f73
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>
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/isert/ib_isert.h