[PATCH 02/10] nvme-discover: assume device given on command line is persistent
Martin Wilck
mwilck at suse.com
Mon Mar 15 17:51:36 GMT 2021
On Mon, 2021-03-15 at 10:41 -0700, Sagi Grimberg wrote:
>
> > From: Martin Wilck <mwilck at suse.com>
> >
> > After commit "nvme-discover: lookup existing persistent
> > controllers",
> > controllers without the "kato" sysfs attribute will never be used
> > by
> > do_discover(). This makes sense for controllers found while
> > traversing
> > sysfs in find_ctrl_with_connectargs(), but if the user passed a
> > device explicitly, it should be used, even on older kernels that
> > don't support the "kato" attribute.
> >
> > Furthermore, make sure allocated memory in
> > ctrl_matches_connectargs()
> > is freed.
>
> This is getting slightly convoluted... what is the motivation again?
>
Currently, users need to specify *both* connect args *and* a discovery
controller device if they want to reuse an existing discovery
controller, which doesn't make much sense from a usability point of
view. The idea is to simply check if a matching discovery controller is
available.
But if we do that blindly, we may erroneously use a temporary
connection that has been set up by some foreign process, and may go
away under us. That's why we do the kato check. But as you pointed out
yourself in your comment on 01/10, that would completely disable using
existing controllers on older kernels that don't have the "kato"
attribute. This patch changes the behavior such that if no kato-
attribute is found, we trust the user if she specified the controller
explicitly, but we don't trust just random controllers found in sysfs.
Thanks,
Martin
More information about the Linux-nvme
mailing list