fix inappropriate size of resv10 [] array field in the nvme_reservation_status based NVMe 1.21 spec.
Add cdw10 field to convey Number of Dwords (NUMD) for the Reservation Report command
Keith Busch [Wed, 31 Aug 2016 17:15:54 +0000 (11:15 -0600)]
Release version v0.9
New extensions, fabrics support, a bug fixes. The 'list' command
is liberated from its udev dependency, and no longer requires
CONFIG_IO_STRICT_DEVMEM be disabled.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Tue, 30 Aug 2016 20:33:54 +0000 (14:33 -0600)]
Simplify list command
Use scandir with an appropriate filter to find all our nvme namespaces
and handle allocating all the dirent's. Makes the implementation a
little simpler.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Tue, 30 Aug 2016 14:49:19 +0000 (08:49 -0600)]
Remove version from list
We can't reliably map controller registers due to kernel memory
protections added in kernel commit 90a545e98, so we are removing its
dependency for the 'list' command to run.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Roy Shterman [Wed, 24 Aug 2016 06:53:06 +0000 (09:53 +0300)]
nvme-cli/fabrics: Added hostnqn parameter to connect command
Added user-defined 'hostnqn' to 'connect' command
so users could use the allowed_hosts attribute on the target and still
connect to target with nvme-cli tool.
Scott Bauer [Mon, 22 Aug 2016 23:19:24 +0000 (17:19 -0600)]
nvme-cli: Implement list command that doesn't rely on libudev
The previous list command required libudev. We can accomplish the same
thing with standard functions. Libudev is still required for some code
in fabrics.c, but the depencency has been removed from nvme.c.
Signed-off-by: Scott Bauer <scott.bauer@intel.com>
Sagi Grimberg [Tue, 16 Aug 2016 09:46:26 +0000 (12:46 +0300)]
fabrics: Allow discover params to come from a conf file
Allow the user to just run "nvme discover" or "nvme connect-all"
in case it finds a default /etc/nvme/nvmf_disc conf file.
We allow multiple discovery addresses by iterating over the
lines of the file and executing a discover (with or without
connect) for each line. We allow newlines and '#' prefixed comments.
The return value is or'ed on all discover attempts.
In order to minimize some parsing code, I just convert the
file line into an (argc, argv) pair and feed it to argconfig_parse()
which dictates that the file lines are identical to what one would
pass nvme discover <params>. I'm open to better ideas.
Jay Freyensee [Thu, 28 Jul 2016 19:23:59 +0000 (12:23 -0700)]
nvme-cli: user-defined hostnqn option for discover
The nvme-cli will always use the default hostnqn
in /dev/nvme-fabrics for the discovery query, even though
both the NVMe Target and NVMe Host rdma implementations allow
user-defined hostnqn naming.
For example, this is the current, somewhat broken behavior if you
used your own hostnqn provision naming on the NVMe kernel target:
Keith Busch [Mon, 1 Aug 2016 21:25:38 +0000 (15:25 -0600)]
Use different error code when command not found
A failed system call returns -1 with errno set, so lets differentiate
a failed system call from not finding a command at all. This suppresses
large help messages on any generic system call failure.
Signed-off-by: Keith Busch <keith.busch@intel.com>
When issuing a read to the device, if we pass a data size smaller than the
current sector size, the ioctl() will overflow the data buffer. This will
also happen when reading more than one block from the device, if the buffer
does not have enough bytes to store the result. This patch adds a simple
check using the requested block count to correctly allocate a buffer of
minimum size.
Signed-off-by: Heitor Ricardo Alves de Siqueira <halves@linux.vnet.ibm.com>
Fix cast to enable nvme to compile on 64-bits architecture
Currently, nvme-cli is enabled on all Debian and Ubuntu architectures,
which includes 64 and 32 bits architecture.
Version 0.8 does not compile in any 32 bits architecture, as it shows:
cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -g -O2 -fPIE
-fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -O2
-g -Wall -Werror -DLIBUDEV_EXISTS -DNVME_VERSION='"0.8"' -c intel-nvme.c
intel-nvme.c: In function ‘get_internal_log’:
intel-nvme.c:310:13: error: cast from pointer to integer of different
size [-Werror=pointer-to-int-cast]
cmd.addr = (__u64)(void *)buf;
^
cc1: all warnings being treated as errors
The cmd.addr field is defined as __u64 on all architectures, but a
pointer is not always 64-bit, making this an error. Cast to 'unsigned
long' instead, which is safe on all supported architectures, and let the
compiler take it from there.
Patch created by Steve Langasek <steve.langasek@ubuntu.com>
The current bash completion file is being installed on the old
/etc/bash_completion.d.
This is the legacy directory, and the new rules ask to include all the
completion files at /usr/share/bash-completion/completions
This patch is required to fix debian lintian errors.
Keith Busch [Mon, 27 Jun 2016 18:22:40 +0000 (12:22 -0600)]
Release nvme-cli v0.8
Lots of updates in this release!
* Code re-organized to support new extensions. While these are called
"plugins", they currently have to be built into the executable. Support
for dynamically loadable plugins is under consideration.
* LightNVM is added as a built-in plugin.
* Intel vendor specific commands and structure decodings are supported
in a new intel plugin.
* Support for NVMe-over-Fabrics
* New output format "json" for a subset of commands that decode returned
structures.
* Lots of various documentation and minor code fixes.
Seems stable, so tagging a release.
Signed-off-by: Keith Busch <keith.busch@intel.com>
root [Mon, 27 Jun 2016 16:28:33 +0000 (09:28 -0700)]
Changed save variable from bool to int
Added "--save/-s" option to man page and documentation
Modified set-feature documentation (Removed invalid command line options, removed references to get-feature, and corrected examples to use set-feature instead of get-feature
root [Tue, 21 Jun 2016 22:31:29 +0000 (15:31 -0700)]
Enhanced both reset and subsystem-reset to return an error message on older kernels with no ioctl support
Added "zeroes based" to the block count documentation for write-uncorr and write-zeroes
Keith Busch [Thu, 16 Jun 2016 18:32:43 +0000 (12:32 -0600)]
fabrics: compile when libudev not installed
libudev is optional to use this repository. Packages can require it if
desired, but others downloading the repo should still be able to use
most of the functionality this tool provides without it.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Tue, 7 Jun 2016 23:02:51 +0000 (17:02 -0600)]
Move program execution to plugin handler
The command list definition is moved to a header file that generates the
structures and prototypes when compiled. This makes it easy to define
new extensions that are not part of the NVMe standard.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Thu, 2 Jun 2016 22:08:31 +0000 (16:08 -0600)]
Seperate kernel uapi from user structures
This pulls in the latest kernel's exported uapi. Including it here
so that it can be used when the kernel headers are either outdated or
not installed.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Wed, 8 Jun 2016 15:59:41 +0000 (09:59 -0600)]
Use pattern rule for compiling objects
All the object files had the same pattern, though some of the targets
were missing the correct dependency list. This fixes them all with a
pattern rule.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Tue, 7 Jun 2016 22:26:56 +0000 (16:26 -0600)]
Move parsing to top directory
We've diverged significantly from the argconfig program that nvme-cli
inherited, so no point in trying to keep it separate. Move it to the
top-level directory to make build rules easier.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Christoph Hellwig [Tue, 7 Jun 2016 15:19:27 +0000 (17:19 +0200)]
implement the connect-all command
Connects to all controllers pointed to by the discovery service.
Includes following referrals.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Ming Lin <ming.l@samsung.com> Tested-by: Ming Lin <ming.l@samsung.com>
Colin Ian King [Fri, 3 Jun 2016 18:27:52 +0000 (19:27 +0100)]
Fix leak of mbuffer on error exit path
building with clang scan-build picked up a memory leak:
nvme.c:2176:3: warning: Potential leak of memory pointed to by 'mbuffer'
fprintf(stderr, "failed to read data buffer from input file\n");
^~~~~~~
instead of returning, jump to free_and_return which performs the
correct cleanup. Also fix the indentation of the return at the end of
the function.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Colin Ian King [Thu, 2 Jun 2016 18:25:54 +0000 (19:25 +0100)]
Fix null pointer dereference on strlen()
If string is NULL, then the proceeding strlen() on the string
will lead to a NULL pointer dereference error (segmentation fault).
Fix this by swapping the order of the comparisons, first check for
a NULL pointer; if that's not true then do the strlen check.
Signed-off-by: Colin Ian King <colin.king@canonical.com>