Jeremy Kerr [Tue, 12 Jul 2022 07:22:47 +0000 (15:22 +0800)]
plugins/wdc: pass a struct nvme_dev around rather than a fd
Currently, the wdc plugin (internally) passes the device fd around. This
change passes the struct nvme_dev instead, so we can access other
members in a future change.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Jeremy Kerr [Tue, 12 Jul 2022 06:55:34 +0000 (14:55 +0800)]
tree: Combine NVMe file descriptor into struct nvme_dev
Currently, our references to the nvme device are fragmented: we have the
device name and stat buf stored in the global nvme_dev, and then a
separate nvme device file descriptor passed between functions
This change moves the fd into the struct nvme_dev:
struct nvme_dev {
+ int fd;
struct stat stat;
const char *name;
};
and changes parse_and_open to now populate a pointer to the dev on
successful return. Callers can now access the fd through dev->fd,
unifying this with the name and statbuf.
[At the moment, this just uses the global nvme_dev variable, but we'll
make that neater in a future change]
There are a large number of functions that use the fd directly, hence
the size of this patch. I've attempted to make this as atomic as
possible, but there are some call sites which warrant some reformatting
as we go here.
There may be some future opportunities to pass around the struct
nvme_dev * rather than the fd, but this change just implements the
minimal change to group our nvme device into the one struct.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Francis Pravin Antony Michael Raj [Sun, 14 Aug 2022 02:30:08 +0000 (22:30 -0400)]
nvme: Add helper function to parse 16-bit comma separated list
In copy command, nlbs is declared as __u16. While parsing command line argument,
it is typecast to integer pointer. So nlbs[1], nlbs[3], nlbs[5], ... are stored
as zero after getting parsed. Therefore it is passing wrong value to controller.
Hence, adding a helper function to parse the 16-bit comma separated list
Signed-off-by: Francis Pravin Antony Michael Raj <francis.michael@solidigm.com> Signed-off-by: Jonathan Derrick <jonathan.derrick@solidigm.com>
Observing unwanted side-effects with nvme discovery. For e.g., running
a simple 'nvme discover' command ends up invoking connect-all as well,
creating namespaces on the host.
One can also see spurious discovery controllers in the 'nvme
list-subsys' output, despite having not created any persistent
discovery controllers at all.
Reported-by: Martin George <Martin.George@netapp.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Jeremy Kerr [Thu, 14 Jul 2022 07:01:22 +0000 (15:01 +0800)]
nvme: Simplify ns list identify
Rather than multiplexing over four functions (which all then call
nvme_identify) just use nvme_identify directly, and set the identify
parameters according to the 'csi' and 'all' parameters.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
[dwagner: changed how the struct args is initialized] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Jeremy Kerr [Tue, 12 Jul 2022 06:45:29 +0000 (14:45 +0800)]
plugins/solidigm: fix return value on format parse failure
If validate_output_format() fails, there are a couple of paths in the
solidgm code that will return a (closed) file descriptor, rather than an
error status. This looks to be a couple of copy-and-paste errors.
This change fixes the return value for these failure path, ensuring that
we'll actually have an error return.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Daniel Wagner [Mon, 1 Aug 2022 11:52:31 +0000 (13:52 +0200)]
fabrics: Remove dhchap-ctrl-secret from discover/connect-all
The dhchap-ctrl-secret is per controller but discover and connect-all
operate on several controllers.
As this get's very fast complicated how to express this on the command
line, just drop the it. It was not implemented anyway and not listed
in the documentation.
Daniel Wagner [Fri, 22 Jul 2022 12:12:00 +0000 (14:12 +0200)]
nvme: Set default rae value for nvme_get_nsid_log users
libnvme 1.0 hard codes the rae value for all nvme_get_nsid_log to
false. The upcoming 1.1 release will pass the rae value through
to the kernel. This is causing a behavior change. To be on the safe
side set all rae=true to false.
At least for nvme_get_log_error and nvme_get_log_smart this seems also
what the spec recommends.
Reported-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Tue, 19 Jul 2022 09:53:12 +0000 (11:53 +0200)]
fabrics: Avoid nvme_scan_ctrl when disconnecting
In certain corner cases, the kernel will not populate a nvme subsystem
but only create a nvme controller. nvme_scan_ctrl will fail in such
scenarios to find the controller object. Let's do the lookup based on
the ctrl name only.
Daniel Wagner [Mon, 18 Jul 2022 14:08:38 +0000 (16:08 +0200)]
build: Update release version rules
Include the release candidate version string into the project
version. This allows to upload every release candidate to PyPI instead
just the final release.
Martin George [Tue, 12 Jul 2022 08:31:08 +0000 (14:01 +0530)]
nvme: fix nvme get-feature with -H option
Currently, nvme get-feature with the -H option fails to print detailed
info for specific feature ids such as number of IO queues (fid=0x07),
async event config (fid=0x0b), KATO value (fid=0x0f), etc. This is
because nvme_feature_show_fields() is invoked only if the corresponding
'buf' pointer is valid, which is not necessary for the above feature
ids. So fix this by removing this restriction while invoking
nvme_feature_show_fields(). At the same time, ensure this 'buf' pointer
is appropriately validated before use in this function.
Fixes: bcab212 ("nvme: coverity fixes") Signed-off-by: Martin George <marting@netapp.com>
Jeremy Kerr [Tue, 12 Jul 2022 07:27:55 +0000 (15:27 +0800)]
plugins/wdc: prevent double close in wdc_do_cap_telemetry_log
Currently, wdc_do_cap_telemetry_log will close the NVMe fd before
returning, but so it all of its call sites. Since we'd be better off
making the fd open/close symmetrical, drop the close from
wdc_do_cap_telemetry_log.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Daniel Wagner [Fri, 8 Jul 2022 10:18:03 +0000 (12:18 +0200)]
nvme: Use correct json serializing for long doubles
Fixup all places which use json_object_add_value_float() to serialize
long double types with json_object_add_value_double(). The float
version cuts off the upper 64 bits of the 128 bit long double type.
submit_io is an internal functions and all callers pass the correct
opcode in. Thus no need to reparse and select the right wrapper
function (nvme_read, nvme_write, ...). Instead just pass the opcode to
the generic nvme_io function.
Note, the compare was fixed in 9b6d3fca4289 ("submit_io(): fix "nvme
compare" to pass correct command") but missed the opportunity to
cleanup this part.
Sagi Grimberg [Mon, 27 Jun 2022 08:06:50 +0000 (11:06 +0300)]
udev: re-read the discovery log page when a discovery controller reconnected
When using persistent discovery controllers, if the discovery
controller loses connectivity and manage to reconnect after a while,
we need to retrieve again the discovery log page in order to learn
about possible changes that may have occurred during this time as
discovery log change events were lost.
Daniel Wagner [Fri, 24 Jun 2022 07:05:18 +0000 (09:05 +0200)]
ci: Add auto review bot
Arthur has asked to be added as reviewer to the OCP plugin changes.
Let's setup an auto review bot. We might also want to hook up this for
the other plugins in the future.