[PATCH 1/3] nvme: decouple nvme_ctrl_get_by_path()

Christoph Hellwig hch at lst.de
Tue Sep 8 04:49:58 EDT 2020


On Sat, Sep 05, 2020 at 10:57:42PM +0000, Chaitanya Kulkarni wrote:
> On 9/5/20 00:20, Christoph Hellwig wrote:
> >> I still don't really like this idea. No need to keep a reference to a
> >> whole other file.
> 
> File reference open/close is coupled with ctrl refcnt and module refcnt.
> What is a problem with keeping the file reference open ?
> 
> > We could still lift the filp_open into the caller, but drop the file
> > reference right after we got the controller reference.
> > 
> 
> The file open call gets the ctrl and module reference atomically and on
> close release the module and ctrl reference respectively.
> 
> If dropping the file reference means closing the file then it will lead
> to loosing the module and ctrl reference.

Not if you grab an extra reference before closing it.

> That also means, moving the references get/put out of
> nvme_dev_open()/nvme_dev_release() in host-core, it will fix the problem
> only for the passthru case. Having done it in the core takes care of the
> all the cases if any.

I don't see why that is an either/or instead of doing both.



More information about the Linux-nvme mailing list