]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
nvme-fc: reject reconnect if io queue count is reduced to zero
authorJames Smart <jsmart2021@gmail.com>
Wed, 13 Mar 2019 17:55:02 +0000 (18:55 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 13 Mar 2019 18:05:40 +0000 (12:05 -0600)
commit834d3710a093aa18c8aa88e6e1892180abadebaf
tree9e9d3960065ae368d5226dedd07d7dc09426b763
parent06f3d71ea071b70e62bcc146cd9ff7ed1f9d4e43
nvme-fc: reject reconnect if io queue count is reduced to zero

If:

 - A successful connect has occurred with an io queue count greater than
   zero and namespaces detected and running.
 - An error or something occurs which causes a termination of the prior
   association and then starts a reconnect,
 - The reconnect then creates a new controller, but for whatever reason,
   nvme_set_queue_count() results in io queue count set to zero.  This
   will skip io queue and tag set changes.
 - But... the controller will transition to live, calling
   nvme_start_ctrl, which calls nvme_start_queues(), which then releases
   I/Os into the transport which then sends them to the driver.

As there are no queues, things eventually hit the driver looking for a
handle, which was cleared when the original controller was reset, and it
can't proceed. Worst case, things progress, but everything fails.

In the failing scenario, the nvme_set_features(NVME_FEAT_NUM_QUEUES)
command actually failed with a NVME_SC_INTERNAL error.  For some reason,
although nvme_set_queue_count() saw the error and set io queue count to
zero, it doesn't return a failure status to the transport, which allows
the transport to continue using the controller.

Fix the problem by simply rejecting the new association if at least 1
I/O queue can't be created. The association reject will fail the
reconnect attempt and fall into the reconnect retry policy.

Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/fc.c