[PATCH V2 07/12] nvmet: decouple nvme_ctrl_get_by_path()

Logan Gunthorpe logang at deltatee.com
Tue Sep 1 13:00:09 EDT 2020



On 2020-08-31 4:27 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.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>

I don't really like this. It just seems like a lot of extra mess to keep
a reference to a file object that we don't really need.

Logan



More information about the Linux-nvme mailing list