[PATCH] nvme: Add module reference counting for multipath nvme device

Wen Xiong wenxiong at linux.ibm.com
Wed Aug 12 07:32:17 PDT 2026


On 2026-08-12 03:43, John Garry wrote:

> Can't the tester also just unbind the device from the driver, which
> does the same (as unloading the driver)?
> 
> Example:
> echo 0000:00:04.0  > /sys/bus/pci/drivers/nvme/unbind
> 
> For this PCI case, we call nvme_remove() -> nvme_remove_namespaces()
> -> nvme_ns_remove(), which removes the NS path and deletes the gendisk
> if the last path. Same effect, as I see.
> 
Yes. Both rmmod nvme and unbind are test cases for the tester.

rmmod nvme should not be allowed when the module reference count is 
non-zero. However, unbind is allowed even when the reference count is 
non-zero; it should decrease the reference count.



More information about the Linux-nvme mailing list