linux/drivers/nvme/target
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
..
admin-cmd.c nvmet: fix space padding in serial number 2018-04-12 09:58:27 -06:00
configfs.c nvmet: refactor configfs transport type handling 2018-03-26 08:53:43 -06:00
core.c nvmet: constify struct nvmet_fabrics_ops 2018-03-26 08:53:43 -06:00
discovery.c nvme: target: fix buffer overflow 2018-04-12 09:58:27 -06:00
fabrics-cmd.c nvmet: lower log level for each queue creation 2018-01-08 11:01:52 +01:00
fc.c nvmet: constify struct nvmet_fabrics_ops 2018-03-26 08:53:43 -06:00
fcloop.c Merge branch 'for-4.16/block' of git://git.kernel.dk/linux-block 2018-01-29 11:51:49 -08:00
io-cmd.c nvmet: Fix nvmet_execute_write_zeroes sector count 2018-04-12 09:58:27 -06:00
Kconfig nvmet/rdma: Use sgl_alloc() and sgl_free() 2018-01-06 09:18:00 -07:00
loop.c nvme: expand nvmf_check_if_ready checks 2018-04-12 09:58:27 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nvmet.h nvmet: constify struct nvmet_fabrics_ops 2018-03-26 08:53:43 -06:00
rdma.c nvmet: constify struct nvmet_fabrics_ops 2018-03-26 08:53:43 -06:00