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

Nilay Shroff nilay at linux.ibm.com
Wed Apr 15 09:21:34 PDT 2026


On 4/15/26 9:23 PM, John Garry wrote:
> 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.
> 
> Signed-off-by: John Garry <john.g.garry at oracle.com>
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 0d623476e36f8..fead3b7cd4bea 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -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:
Reviewed-by: Nilay Shroff <nilay at linux.ibm.com>



More information about the Linux-nvme mailing list