Skip to contentSkip to conversation

nvme-multipath: put module reference when delayed removal work is canceled

PATCH Applied John Garry 5 participants 5 messages Apr 15 – Apr 16 NVMe

lore
Share & tools
lore

John Garry

author
#0 lore raw

PATCH 1/1 nvme-multipath: put module reference when delayed removal work is canceled

The delayed disk removal work is canceled when a NS (re)appears. However, we do not put the module reference grabbed in nvme_mpath_remove_disk(), so fix that.

drivers/nvme/host/core.c +2 -1
index 0d623476e36f8..fead3b7cd4bea 100644
@@ -4083,7 +4083,8 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
 	mutex_unlock(&ctrl->subsys->lock);
 
 #ifdef CONFIG_NVME_MULTIPATH
-	cancel_delayed_work(&head->remove_work);
+	if (cancel_delayed_work(&head->remove_work))
+		module_put(THIS_MODULE);
 #endif
 	return 0;
 
Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · John Garry

The delayed disk removal work is canceled when a NS (re)appears. However, we do not put the module reference grabbed in nvme_mpath_remove_disk(), so fix that.

drivers/nvme/host/core.c +0 -0
index 0d623476e36f8..fead3b7cd4bea 100644

drivers/nvme/host/core.c static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info) · line 4090

Quoted 9 lines
drivers/nvme/host/core.c +2 -1
@@ -4083,7 +4083,8 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
  	mutex_unlock(&ctrl->subsys->lock);
 
  #ifdef CONFIG_NVME_MULTIPATH
-	cancel_delayed_work(&head->remove_work);
+	if (cancel_delayed_work(&head->remove_work))
+		module_put(THIS_MODULE);
  #endif
  	return 0;
 

Looks good to me:

maintainer Applied
#4 lore raw
In reply to John Garry
Quoted 3 lines · John Garry

The delayed disk removal work is canceled when a NS (re)appears. However, we do not put the module reference grabbed in nvme_mpath_remove_disk(), so fix that.

Thanks, applied to nvme-7.1.