OpenCloudOS-Kernel/drivers/nvme/target
James Smart 0fb228d30b nvmet_fc: add defer_req callback for deferment of cmd buffer return
At queue creation, the transport allocates a local job struct
(struct nvmet_fc_fcp_iod) for each possible element of the queue.
When a new CMD is received from the wire, a jobs struct is allocated
from the queue and then used for the duration of the command.
The job struct contains buffer space for the wire command iu. Thus,
upon allocation of the job struct, the cmd iu buffer is copied to
the job struct and the LLDD may immediately free/reuse the CMD IU
buffer passed in the call.

However, in some circumstances, due to the packetized nature of FC
and the api of the FC LLDD which may issue a hw command to send the
wire response, but the LLDD may not get the hw completion for the
command and upcall the nvmet_fc layer before a new command may be
asynchronously received on the wire. In other words, its possible
for the initiator to get the response from the wire, thus believe a
command slot free, and send a new command iu. The new command iu
may be received by the LLDD and passed to the transport before the
LLDD had serviced the hw completion and made the teardown calls for
the original job struct. As such, there is no available job struct
available for the new io. E.g. it appears like the host sent more
queue elements than the queue size. It didn't based on it's
understanding.

Rather than treat this as a hard connection failure queue the new
request until the job struct does free up. As the buffer isn't
copied as there's no job struct, a special return value must be
returned to the LLDD to signify to hold off on recycling the cmd
iu buffer.  And later, when a job struct is allocated and the
buffer copied, a new LLDD callback is introduced to notify the
LLDD and allow it to recycle it's command iu buffer.

Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2017-08-10 11:06:38 +02:00
..
Kconfig nvme-fabrics: Add FC LLDD loopback driver to test FC-NVME 2016-12-06 14:51:48 +01:00
Makefile nvme-fabrics: Add FC LLDD loopback driver to test FC-NVME 2016-12-06 14:51:48 +01:00
admin-cmd.c nvmet: don't report 0-bytes in serial number 2017-07-20 08:41:56 -06:00
configfs.c nvmet: preserve controller serial number between reboots 2017-07-20 08:41:56 -06:00
core.c nvmet: Move serial number from controller to subsystem 2017-07-20 08:41:56 -06:00
discovery.c nvme: use a single NVME_AQ_DEPTH and relax it to 32 2017-06-28 08:14:13 -06:00
fabrics-cmd.c nvmet: convert from kmap to nvmet_copy_from_sgl 2017-04-21 16:41:47 +02:00
fc.c nvmet_fc: add defer_req callback for deferment of cmd buffer return 2017-08-10 11:06:38 +02:00
fcloop.c nvmet-fc: Remove a set-but-not-used variable 2017-06-15 14:30:25 +02:00
io-cmd.c nvmet: avoid unneeded assignment of submit_bio return value 2017-07-10 18:45:38 +03:00
loop.c nvme: split nvme_uninit_ctrl into stop and uninit 2017-07-06 09:49:42 +03:00
nvmet.h nvmet: Move serial number from controller to subsystem 2017-07-20 08:41:56 -06:00
rdma.c nvmet-rdma: register ib_client to not deadlock in device removal 2017-06-28 08:14:13 -06:00