Re: [PATCH v3 2/2] nvme: fix cdev lifetime
John Garry <[email protected]>
| Newsgroups | org.infradead.lists.linux-nvme |
|---|---|
| Organization | Oracle Corporation |
| Message-ID | <[email protected]> |
On 17/07/2026 08:10, Nilay Shroff wrote: >> nvme_ns_chr_open() and nvme_ns_chr_release() call nvme_ns_open() and nvme_ns_relase(), respectively, and they do more than get and put a ref to the NS - specifically they also check that they are not called for multipath mode (as the NS bdev/cdev should be hidden) and take/put a reference to the controller ops module. Why are those addition actions not required for the cdev? Or should it be done when we add/del the cdev (like in this patch)? >> > > I think the first check in nvme_ns_open() that verifies we have not entered > while multipath is enabled is essentially a sanity/paranoia check. > And just a nvme_ns_chr_open() version which does this check has no value. > As for the module reference, I think that is redundant for the cdev path. > chrdev_open() already takes a reference to module before invoking > nvme_ns_chr_open(), so IMO, nvme_ns_open() taking another reference to > module appears unnecessary for this path. > > Unless I'm missing something, it seems nvme_ns_chr_open()/nvme_ns_chr_release() > don't provide any additional lifetime guarantees for the cdev beyond what is > already handled elsewhere. Yeah, it seems that way.