Minwoo Im [Sun, 15 Apr 2018 17:34:41 +0000 (02:34 +0900)]
nvme-cli: add support for id-nvmset subcommand
Identify for NVM Set List has been added and it can be found in TP 4018.
This identify CNS 0x4 uses CDW11 as a NVM Set Identify(NVMSETID).
Currently nvme-cli is not using cdw11 for the identify command.
Therefore make it available for cdw11 to be passed to ioctl command by
adding nvme_identify13() to support the new CNS.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
James Smart [Mon, 30 Apr 2018 22:46:58 +0000 (15:46 -0700)]
nvme-cli: Add ioctl retry support for "connect-all"
Currently, if an ioctl command to a controller fails, the routines
within nvme-cli don't do retries and just fail. In the case of
operations such as "connect-all" which depend on the ioctl to read
the discovery log to give it the list of controller to then "connect"
to, this failure can be catastrophic as there's no guarantee that the
event/admin action that performed the connect-all will be re-triggered,
resulting in a loss of connectivity to storage subsystems.
As to why the ioctl may have failed in the first place: if the
controller is in the middle of a reset or reconnect due to
an error or temporary loss of connectivity (which can happen even
on a discovery controller), ioctl commands will fail rather than
suspend for the full duration of the controller state change
(say to live or delete), which could be a minute or more.
This patch makes the following changes:
- Implement an ioctl wrapper that does retries. The ioctl will only
retry if the failure status was EAGAIN.
- Create an admin passthru wrapper that uses the ioctl wrapper with
retry
= Modify the ioctl that reads the discovery log to use the new
admin passthru wrapper that performs retries when reading the
discovery log, and uses the normal admin passthru (no retries)
for all other log types.
Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
James Smart [Fri, 27 Apr 2018 17:29:39 +0000 (10:29 -0700)]
nvme-cli: Wait for device file if not present after successful add_ctrl
It's possible for the transport to return very quickly after add_ctrl
such that the cli may attempt to access the /dev/nvme? device file
before the udev event has propagated to user space to create the device
file. In these cases, the open fails with EAGAIN.
As the add_ctrl call was successful, thus there "should" be a device
file, if the open fails with EAGAIN delay 500ms and try again. Wait
for at most 2 seconds for the device file to come into existence.
Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
James Smart [Fri, 27 Apr 2018 17:27:33 +0000 (10:27 -0700)]
nvme-cli: show partial results if controller fails during list and list-subsys
For the current versions of "list" and "list-subsys":
If a command to a controller fails, which is possible if the controller
is going through a reconnect, the operation will fail and all results
gathered up to that point is dropped. Thus, the operation shows no
results.
Revise the commands so that they will report an error if one of the
controllers fail, but will now skip over the failing controller and
continue with the next one.
Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
Minwoo Im [Sun, 15 Apr 2018 16:23:45 +0000 (01:23 +0900)]
nvme-cli: fix perror when blkdev not given when get-ns-id
nvme-cli currently is printing out the error code via perror when nsid
from the nvme_get_nsid(fd) <= 0. Once user gives a chrdev node instead of
blkdev node, following "Success" message is being printed-out even it's
a failure case.
Error: requesting namespace-id from non-block device
nvme0: Success
errno will *not* be set in case that blkdev is not given. So set the
proper errno for this case. The following message will be nicer than
previous one.
Error: requesting namespace-id from non-block device
nvme0: Block device required
This patch will also fix the return value of this subcommand. 0 will
*not* be given when the subcommand fails.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Thu, 12 Apr 2018 12:38:25 +0000 (21:38 +0900)]
nvme-cli: make it return 0 in case of non-fabric for show-regs
Currently, non-fabrics show-regs subcommand is *not* returning 0 even if it has
successfully read from the bar. Make it return 0 when successfully done.
Link: #338
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Johannes Thumshirn [Tue, 10 Apr 2018 08:51:10 +0000 (10:51 +0200)]
Documentation: add manpage entry for connect's --ctrl-loss-tmo setting
When adding nvme connect's --ctrl-loss-tmo flag we forgot to update
the manpage accordingly.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Matt Schulte <matt.schulte@netapp.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Wed, 4 Apr 2018 14:14:26 +0000 (08:14 -0600)]
Remove error print for telemetry log arg parse
We don't want to see an error message if the '--help' option was
utilized. Parsing errors are also already printed, so don't need the
second error message anyway.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Rodrigo R. Galvao [Tue, 20 Mar 2018 19:10:46 +0000 (16:10 -0300)]
nvme-cli: Add friendly status messages
Additional messages were added on nvme_status_to_string(), in
order to make the returned status easier to understand.
The messages were based in the Description of those statuses in
the NVMe Specification (v1.3), from the figures 31-36.
Signed-off-by: Rodrigo R. Galvao <rosattig@linux.vnet.ibm.com>
Keith Busch [Mon, 19 Mar 2018 22:55:34 +0000 (16:55 -0600)]
get-log: Make log identifier a required parameter
If you're using the generic get-log, make sure the user specifies the
log parameter. It would be a user error if they don't as they should
never be counting on a default parameter.
Vijay Kumar [Wed, 7 Mar 2018 01:24:12 +0000 (18:24 -0700)]
Log error incase of failure in get_nvme_subsystem_info()
Currently get_nvme_subsystem_info() silently fails in case
of error. This patch logs relevant error message incase of
failure in get_nvme_subsystem_info().
Vijay Kumar [Wed, 7 Mar 2018 01:45:34 +0000 (19:45 -0600)]
Fix double free in list_subsys
get_nvme_subsystem_info() deallocates subsys_list_item in case of error.
This hits double free when list_subsys() as well attempts to free it.
Removed deallocation of subsys_list_item from get_nvme_subsystem_info().
Keith Busch [Mon, 12 Feb 2018 15:03:26 +0000 (08:03 -0700)]
Fix freeing wrong address
We increment the pointer for the firmware buffer as we read it, so we
can't free that value. This patch saves the original address so it may
be freed later.