[PATCH v2] nvme: avoid "(efault)" from nvme_sysfs_show_subsysnqn()

Martin Wilck mwilck at suse.com
Wed Feb 3 07:31:13 EST 2021


On Tue, 2021-02-02 at 08:58 +0100, Christoph Hellwig wrote:
> On Tue, Feb 02, 2021 at 01:59:51AM +0100, mwilck at suse.com wrote:
> > From: Martin Wilck <mwilck at suse.com>
> > 
> > While a controller is still connecting, ctrl->subsys is NULL and
> > thus reading the controller's "subsysnqn" sysfs attribute returns
> > "(efault)". This happens all the time when user space processes
> > "add" events for NVMe controller devices.
> > 
> > Fix it by returning the nvmf_ctrl_options' subsysnqn attribute
> > if ctrl->subsys isn't initialized yet.
> 
> This is just papering over symptoms.  We should not be sending
> events or display sysfs files until the controlle is live.

I don't follow. What's wrong with a "connecting" controller device in
sysfs? 

Controllers can loose connectivity any time. What's the difference
between a controller that is reconnecting after a connection loss and a
freshly created controller that's just not live yet? You wouldn't
delete the former from sysfs, I suppose.

>From the user space point of view, it's the same, a controller device
that is not in usable state. I don't see a general problem with that.
Seeing a controller appear in connecting state might actually be useful
for user space.

The subsysnqn attribute is correct for controllers that were once
connected and lost connectivity. My patch was only intended to fix the
"just created and never connected" case, where it is not, nothing more.

Regards
Martin

> 
> In other wwords - I think we should remove the cdev_device_add
> from nvme_init_ctrl to nvme_start_ctrl (+ any error handling changes
> resulting from that).
> 





More information about the Linux-nvme mailing list