Guan Junxiong [Wed, 21 Jun 2017 05:09:24 +0000 (13:09 +0800)]
nvme-cli: add output-format discription for smart-log
The nvme smart-log command has implemented output-format option,
but the documentation of the command doesn't reflect this. This
patch synchronizes the documentation with the implemenation.
Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
Guan Junxiong [Wed, 21 Jun 2017 05:09:22 +0000 (13:09 +0800)]
nvme-cli: add thermal management fields for smart-log
NVMe 1.3 introduce new thermal management temperature related
fields into the smart log page. Those fileds include
two temperature transition counts and two total time.
Johannes Thumshirn [Fri, 23 Jun 2017 07:36:35 +0000 (09:36 +0200)]
nvme-cli: add ns-descs subcommand
NVMe 1.3 defines the "Namespace Identification Descriptor" command in
NVMe Identify NS. This command returns a list of so called Namespace
Identificastion Descriptors which currently can either be a EUI-64,
a NGUID or a UUID.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Keith Busch <keith.busch@intel.com>
Zou [Fri, 16 Jun 2017 07:12:52 +0000 (07:12 +0000)]
nvme-cli: add id-ctrl for nvme-huawei plug-in.
add Vendor unique command id-ctrl for Huawei devices. Signed-off-by: Zou Ming <zouming.zouming@huawei.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
Guan Junxiong [Fri, 2 Jun 2017 07:18:19 +0000 (15:18 +0800)]
nvme-cli: show more fields for id-ctrl
NVMe 1.3 inctrodues new fields such as EDSTT, DSTO, FWUG, HCTMA, MNTMT,
MXTMT, SANICAP into the idenfity controller data structure. The id-ctrl
command should print them or write them into json format. Note that
although KAS field is included in the previous NVMe 1.2.1 spec, this
patch also supports this field.
Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <keith.busch@intel.com>
Guan Junxiong [Fri, 2 Jun 2017 07:18:18 +0000 (15:18 +0800)]
nvme-cli: add fields into identify controller data structure
NVMe 1.3 inctrodues new fields such as EDSTT, DSTO, FWUG, HCTMA, MNTMT, MXTMT, SANICAP
into the idenfity controller data structure. So we add them. Note that KAS field is
included in the previous NVMe 1.2.1 spec, but not itemized in the nvme-cli.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Aaron Miller [Tue, 6 Jun 2017 02:02:50 +0000 (19:02 -0700)]
fix use-after-free in pci.ids parsing
If a device that is not in pci.ids has its name looked up after a device
that *was* present in pci.ids, these pointers are still set even though
they've been free'd, and then get passed to snprintf resulting in a
use-after-free.
Keith Busch [Thu, 18 May 2017 15:17:45 +0000 (11:17 -0400)]
Release v1.3
Tagging v1.3 for release:
* Fixes compiler errors and warnings for some architectures
* Fixes to the security commands
* Updates and fixes to output formats
* New vendor plugin from Huawei
* Minor updates to fabrics and lightnvm
* Fixes for package generation
Signed-off-by: Keith Busch <keith.busch@intel.com>
Johannes Thumshirn [Thu, 11 May 2017 17:48:37 +0000 (19:48 +0200)]
fabrics: add option to override drivers queue depth also for connect-all command
Currently it is not possible to override the fabrics drivers default
queue depth with the nvme userspace utility's 'connect-all' command,
but only when using the 'connect' command.
Add an option to override the drivers default queue depth for NVMe
over fabrics with the 'connect-all' command as we did previouslt with the
'connect' command.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Keith Busch <keith.busch@intel.com>
Tony Asleson [Wed, 17 May 2017 19:59:01 +0000 (14:59 -0500)]
Fix potential device string truncation
While compiling using gcc 7.1.1 I ran into compile errors, eg.
nvme.c: In function ‘scan_dev_filter.part.5’:
nvme.c:797:35: error: ‘%s’ directive output may be truncated writing " \
"up to 255 bytes into a region of size 251 [-Werror=format-truncation=]
snprintf(path, sizeof(path), "%s%s", dev, d->d_name);
This is caused because the buffer on the stack is only 256 bytes and the
dirent.d_name is 256 and the constant string is "/dev/", so 256 + 5,
but I've rounded up to nearest 4/8 byte alignment of 264.
Johannes Thumshirn [Wed, 10 May 2017 09:04:12 +0000 (11:04 +0200)]
fabrics: add option to override drivers queue depth
Currently it is not possible to override the fabrics drivers default queue
depth with the nvme userspace utility, but only when manually writing the
parameters to the /dev/nvme-fabrics character device.
Add an option to override the drivers default queue depth for NVMe over
fabrics.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Keith Busch <keith.busch@intel.com>
Need to include sys/stat.h to fix:
fabrics.c:414:45: error: 'S_IRUSR' undeclared (first use in this function)
fabrics.c:414:53: error: 'S_IWUSR' undeclared (first use in this function)
Yi Zhang [Tue, 18 Apr 2017 09:20:24 +0000 (17:20 +0800)]
nvme-cli: return 0 if disconnect operation with cfg.nqn successfully
disconnect_by_nqn function will return the number of controllers
successfully disconnected, so change ret = 0 if disconnect operation
with nqn successfully.
Thomas Bowen [Tue, 14 Mar 2017 19:58:14 +0000 (12:58 -0700)]
Fixed problem with security-recv binary output not working correctly
Security Receive sent the wrong pointer, specifically a pointer to a
stack location. When using the Dump raw command we would dump stack
contents, not the buffer received from the controller.
Signed-off-by: Thomas Bowen <thomas.r.bowen@intel.com> Signed-off-by: Scott Bauer <Scott.Bauer@intel.com>
Javier González [Wed, 5 Apr 2017 10:10:27 +0000 (12:10 +0200)]
lightnvm: allow to init target on factory mode
Allow to drop the target recovery mechanism when creating a target in
order to start in factory mode. This facilitates development and makes
it possible to evaluate an OCSSD in different states.
Signed-off-by: Javier González <javier@cnexlabs.com>
Logan Gunthorpe [Tue, 28 Mar 2017 19:26:41 +0000 (13:26 -0600)]
fabrics: Fix disconnect_by_device from disconnecting instance 0 on error
I was a bit surprised that running:
nvme disconnect -d /dev/nvme1
actually disconnected nvme0 and I could never disconnect nvme1. Turns
out the code was not expecting a full path and silently used instance
zero if it failed to parse any arguments.
This patch fixes it so that it ignores any path component and fails if
sscanf doesn't match any items.
Keith Busch [Wed, 15 Mar 2017 15:33:35 +0000 (11:33 -0400)]
nvme-cli: Release v1.2
Changes in this release:
New vendor pluging from Western Digital.
Better memory usage on program tear down. Will be more important if
we have an interactive mode in the future.
Minor code reorganization to keep vendor uniqueness out of common code.
Conditionally compile without uuid support if library is not
installed. This is mainly to silence the complaints, as having libuuid
is very useful for fabrics.
Documentation updates and fixes.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Tue, 14 Mar 2017 15:49:42 +0000 (11:49 -0400)]
nvme-cli/format: use existing LBAF if none requested
We previously default to LBAF 0 if the user didn't specify one. If a
specific LBAF is not explicitly requested, most people expect format
to not change their currently in use LBAF. This patch uses the current
format if we have a namespace to query.
https://github.com/linux-nvme/nvme-cli/issues/164
Signed-off-by: Keith Busch <keith.busch@intel.com>
Christoph Hellwig [Mon, 13 Mar 2017 23:10:52 +0000 (17:10 -0600)]
remove json_add_smart_log
This is the json variant of the Intel additional smart log, but it
appears to be entirely unused. If we want to bring it back it should
be moved to intel-nvme.c, though.
Roland Dreier [Thu, 2 Mar 2017 18:06:21 +0000 (10:06 -0800)]
fabrics: Handle space-padded TRSVCID and TRADDR fields
The TRSVCID and TRADDR fields in the discovery log page are defined
as ASCII strings, which according to the NVMe standard means they
should be space-padded rather than NUL-terminated.
The current nvme-cli code will print all the spaces and possibly some
garbage from the next field. For example this causes "connect-all"
to write strings that get rejected with "malformed IP address passed."
Fix this by only writing the contents of these fields until the last
non-space character, and limiting the length to the size of the field.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Chaitanya Kulkarni [Wed, 1 Mar 2017 02:14:09 +0000 (18:14 -0800)]
nvme-cli: Western Digital/HGST plug-in.
This patch adds support for Vendor unique commands for
Western Digital/HGST devices. Following commands are
supported in current version of this extension:-
Chaitanya Kulkarni [Wed, 1 Mar 2017 02:14:07 +0000 (18:14 -0800)]
nvme-cli: id-ctrl: Add vendor fields in JSON id-ctrl.
As a part of the id-ctrl command vendor specific callback is issued.
This patch allows the vendor-specific callback to print the extended
vendor unique (ctrl->vs) information from identify controller
data structure in the JSON format. It also enables id-ctrl command
to print vendor specific fields along with generic id-ctrl fields
in one JSON object. This modifies Intel plug-in which is the only
one uses extended id-ctrl (cs->vs) information in current
implementation.
Chaitanya Kulkarni [Sun, 26 Feb 2017 07:34:42 +0000 (23:34 -0800)]
nvme-cli: smart-log: Allow negative values for temp sensors.
HGST devices allowed to produce valid negative values for
"Temperature Sensor 1" of the smart-log command. Change the
temperature sensor value from unsigned to signed so that
negative values will be printed correctly.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:37 +0000 (18:39 -0800)]
nvme-cli: json_add_smart_log(): Fix memory leak for JSON.
This patch fixes the following memory leak for json_add_smart_log()
when used by the external function:-
==8637== HEAP SUMMARY:
==8637== in use at exit: 1,807 bytes in 56 blocks
==8637== total heap usage: 101 allocs, 45 frees, 6,577 bytes allocated
==8637==
==8637== LEAK SUMMARY:
==8637== definitely lost: 24 bytes in 1 blocks
==8637== indirectly lost: 1,783 bytes in 55 blocks
==8637== possibly lost: 0 bytes in 0 blocks
==8637== still reachable: 0 bytes in 0 blocks
==8637== suppressed: 0 bytes in 0 blocks
Fix:-
==8667== HEAP SUMMARY:
==8667== in use at exit: 0 bytes in 0 blocks
==8667== total heap usage: 101 allocs, 152 frees, 6,577 bytes allocated
==8667==
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:32 +0000 (18:39 -0800)]
nvme-cli: id-ns: Fix memory leak for JSON.
This patch fixes the following memory leak when id-ns command
executed with JSON option:-
==7642==
==7642== HEAP SUMMARY:
==7642== in use at exit: 3,297 bytes in 120 blocks
==7642== total heap usage: 182 allocs, 62 frees, 9,204 bytes allocated
==7642==
==7642== LEAK SUMMARY:
==7642== definitely lost: 24 bytes in 1 blocks
==7642== indirectly lost: 3,273 bytes in 119 blocks
==7642== possibly lost: 0 bytes in 0 blocks
==7642== still reachable: 0 bytes in 0 blocks
==7642== suppressed: 0 bytes in 0 blocks
==7642== Rerun with --leak-check=full to see details of leaked memory
==7642==
Fix:-
==7949==
==7949== HEAP SUMMARY:
==7949== in use at exit: 0 bytes in 0 blocks
==7949== total heap usage: 182 allocs, 182 frees, 9,204 bytes allocated
==7949==
Matias Bjørling [Wed, 15 Feb 2017 14:57:32 +0000 (15:57 +0100)]
lightnvm: default to -1 on lun begin and end
The default behavior when initializing a target without lun end and
begin is to use only the first lun of the OCSSD. Going forward, the
user shall either explicit specific the begin and end, or if not defined
for kernel 4.11 and newer, the full SSD is initialized.
Andy Lutomirski [Thu, 1 Sep 2016 15:27:48 +0000 (08:27 -0700)]
get-features: Don't try to read the data buffer for sel == 3
When sel == 3, the controller returns capabilities in the completion
entry and does not produce a feature value blob. Stop allocating
space for the blob and displaying it -- the result is garbage.
Sagi Grimberg [Thu, 12 Jan 2017 11:13:29 +0000 (13:13 +0200)]
nvme.spec/debian: Auto generate host nqn as part of install
The installation will generate a hostnqn and store it in
/etc/nvme/hostnqn file (in case it doesn't exist).
This file will be removed upon uninstallation (purge on for debian).
Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Sagi Grimberg [Thu, 12 Jan 2017 11:13:28 +0000 (13:13 +0200)]
nvme-cli: Add nvme hostnqn generation option
Add option to generate a NVMe qualified name of a given host
(in the form of: nqn.2014-08.org.nvmexpress:NVMf:uuid:<some_uuid>).
This hostnqn will be used for fabrics discovery and connect functions.
Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Keith Busch [Wed, 21 Dec 2016 22:24:31 +0000 (17:24 -0500)]
Release v1.1
This fixes multiple compiler warnings for 32-bit and other environments
from v1.0, adds more documentation to fabrics, removes the libudev
dependency entirely from this project, adds a framework for unit testing
devices, and fixes usage for user defined install paths.
Signed-off-by: Keith Busch <keith.busch@intel.com>