From: Max Gurtovoy Date: Wed, 28 Feb 2018 11:12:39 +0000 (+0200) Subject: nvme-rdma: Don't flush delete_wq by default during remove_one X-Git-Tag: v5.15~9111^2~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9bad0404ecd7594265cef04e176adeaa4ffbca4a;p=platform%2Fkernel%2Flinux-starfive.git nvme-rdma: Don't flush delete_wq by default during remove_one The .remove_one function is called for any ib_device removal. In case the removed device has no reference in our driver, there is no need to flush the work queue. Reviewed-by: Israel Rukshin Signed-off-by: Max Gurtovoy Reviewed-by: Sagi Grimberg Signed-off-by: Keith Busch Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index f5f460b..250b277 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -2024,6 +2024,20 @@ static struct nvmf_transport_ops nvme_rdma_transport = { static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data) { struct nvme_rdma_ctrl *ctrl; + struct nvme_rdma_device *ndev; + bool found = false; + + mutex_lock(&device_list_mutex); + list_for_each_entry(ndev, &device_list, entry) { + if (ndev->dev == ib_device) { + found = true; + break; + } + } + mutex_unlock(&device_list_mutex); + + if (!found) + return; /* Delete all controllers using this device */ mutex_lock(&nvme_rdma_ctrl_mutex);