nvmet-rdma: Don't flush system_wq by default during remove_one
Subsystems (2)
PATCH v3 1/2 nvmet-rdma: Don't flush system_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 system work queue.
---
Changes from v2:
- remove wrong WARNING in case device not found
Changes from v1:
- check for the ib_device in the device list
--- drivers/nvme/target/rdma.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/nvme/target/rdma.c +18 -1
@@ -1460,8 +1460,25 @@ static void nvmet_rdma_remove_port(struct nvmet_port *port)static void nvmet_rdma_remove_one (struct ib_device *ib_device,void *client_data) {struct nvmet_rdma_queue *queue, *tmp; +struct nvmet_rdma_device *ndev; +bool found = false; + +mutex_lock (&device_list_mutex); +list_for_each_entry (ndev, &device_list, entry) { +if (ndev->device == ib_device) { + found = true; +break ; + } + } +mutex_unlock (&device_list_mutex); + +if (!found) +return ; -/* Device is being removed, delete all queues using this device */ +/* +* IB Device that is used by nvmet controllers is being removed, +* delete all queues using this device. +*/ mutex_lock (&nvmet_rdma_queue_mutex);list_for_each_entry_safe (queue, tmp, &nvmet_rdma_queue_list, queue_list) {
Signature · 1 line
1.8.3.1
PATCH v3 2/2 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.
---
Changes from v2:
- remove wrong WARNING in case device not found
Changes from v1:
- check for the ib_device in the device list
--- drivers/nvme/host/rdma.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/nvme/host/rdma.c +14 -0
@@ -2025,6 +2025,20 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,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);
Signature · 1 line
1.8.3.1
Sagi Grimberg
maintainerPATCH v3 2/2 nvme-rdma: Don't flush delete_wq by default during remove_one
Looks fine,
Sagi Grimberg
maintainerPATCH v3 1/2 nvmet-rdma: Don't flush system_wq by default during remove_one
In reply to Max GurtovoyLooks fine,
PATCH v3 1/2 nvmet-rdma: Don't flush system_wq by default during remove_one
Thanks, series applied for 4.17 with Sagi's review.