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

Logan Gunthorpe logang at deltatee.com
Fri Sep 4 11:54:48 EDT 2020



On 2020-09-03 8:39 p.m., Chaitanya Kulkarni wrote:
> Right now nvme_ctrl_get_by_path() accepts ctrl path, based on that it
> opens a file and calls nvme_get_ctrl(). In order to take module
> refcount it is important to distinguish the error between file_open()
> and module file ops check so that we can unwind the code in the caller
> nvmet_passthru_ctrl_enable() in the error path.
> 
> Rename nvme_ctrl_get_by_path() -> nvme_ctrl_get_by_file() and lift
> the file opening and error handling in the caller so that we can unwind
> appropriately in the error path.

I still don't really like this idea. No need to keep a reference to a
whole other file.

Logan



More information about the Linux-nvme mailing list