Make multi-namespace nvme drives more robust.
authorimp <imp@FreeBSD.org>
Tue, 7 Mar 2017 21:47:54 +0000 (21:47 +0000)
committerimp <imp@FreeBSD.org>
Tue, 7 Mar 2017 21:47:54 +0000 (21:47 +0000)
commit07867512352e056493a469bc3295f4047bbb5d12
tree493c00b4c8927dc979225b974eadee42dea9c44f
parentec4f9c71579bd567b06780b52dcca4a137a1fdab
Make multi-namespace nvme drives more robust.

Fix assumptions about name spaces in NVME driver. First, it assumes
cdata.nn is the number of configured devices. However, it is the
number of supported name spaces. Second, it assumes that there will
never be more than 16 name spaces supported, but a certain drive I'm
testing reports 1024. It assumes that name spaces are a tightly packed
namespace, but the standard seems to indicate otherwise. Finally, it
assumes that an error would be generated when quearying an
unconfigured namespace. Instead, it succeeds but the identify data is
all zeros.

Fix these by limiting the number of name spaces we probe to 16. Remove
aborting when we find one in error. When the size of the name space is
zero, ignore it.

This is admittedly a bandaide. The long term fix will be to
participate in the enumeration and name space change protocols
definfed in the NVNe standard.

Sponsored by: Netflix
sys/dev/nvme/nvme.c
sys/dev/nvme/nvme_ctrlr.c
sys/dev/nvme/nvme_ns.c