linux/drivers/nvme/host
James Smart bb06ec3145 nvme: expand nvmf_check_if_ready checks
The nvmf_check_if_ready() checks that were added are very simplistic.
As such, the routine allows a lot of cases to fail ios during windows
of reset or re-connection. In cases where there are not multi-path
options present, the error goes back to the callee - the filesystem
or application. Not good.

The common routine was rewritten and calling syntax slightly expanded
so that per-transport is_ready routines don't need to be present.
The transports now call the routine directly. The routine is now a
fabrics routine rather than an inline function.

The routine now looks at controller state to decide the action to
take. Some states mandate io failure. Others define the condition where
a command can be accepted.  When the decision is unclear, a generic
queue-or-reject check is made to look for failfast or multipath ios and
only fails the io if it is so marked. Otherwise, the io will be queued
and wait for the controller state to resolve.

Admin commands issued via ioctl share a live admin queue with commands
from the transport for controller init. The ioctls could be intermixed
with the initialization commands. It's possible for the ioctl cmd to
be issued prior to the controller being enabled. To block this, the
ioctl admin commands need to be distinguished from admin commands used
for controller init. Added a USERCMD nvme_req(req)->rq_flags bit to
reflect this division and set it on ioctls requests.  As the
nvmf_check_if_ready() routine is called prior to nvme_setup_cmd(),
ensure that commands allocated by the ioctl path (actually anything
in core.c) preps the nvme_req(req) before starting the io. This will
preserve the USERCMD flag during execution and/or retry.

Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.e>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-04-12 09:58:27 -06:00
..
core.c nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
fabrics.c nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
fabrics.h nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
fault_inject.c nvme: Add fault injection feature 2018-03-26 08:53:43 -06:00
fc.c nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
Kconfig nvme: implement multipath access to nvme subsystems 2017-11-10 19:53:25 -07:00
lightnvm.c lightnvm: remove function name in strings 2018-03-29 17:29:09 -06:00
Makefile nvme: Add fault injection feature 2018-03-26 08:53:43 -06:00
multipath.c for-4.17/block-20180402 2018-04-05 14:27:02 -07:00
nvme.h nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
pci.c nvme-pci: Separate IO and admin queue IRQ vectors 2018-04-12 09:58:27 -06:00
rdma.c nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
trace.c nvme: add tracepoint for nvme_setup_cmd 2018-01-26 12:34:40 +01:00
trace.h nvme: add tracepoint for nvme_complete_rq 2018-01-26 12:34:40 +01:00