nvme-tcp: fix timeout handler
authorSagi Grimberg <sagi@grimberg.me>
Tue, 28 Jul 2020 20:16:36 +0000 (13:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 11:55:35 +0000 (13:55 +0200)
commit18aca936e2fffd06a330dc5d88ec31fbed22901f
treef7eb0b3a7550ae8557e0332d26ef4f9441bb438a
parentc0e1cf0f6ac2aef75110465dfa8de8341cdbf2b5
nvme-tcp: fix timeout handler

[ Upstream commit 236187c4ed195161dfa4237c7beffbba0c5ae45b ]

When a request times out in a LIVE state, we simply trigger error
recovery and let the error recovery handle the request cancellation,
however when a request times out in a non LIVE state, we make sure to
complete it immediately as it might block controller setup or teardown
and prevent forward progress.

However tearing down the entire set of I/O and admin queues causes
freeze/unfreeze imbalance (q->mq_freeze_depth) because and is really
an overkill to what we actually need, which is to just fence controller
teardown that may be running, stop the queue, and cancel the request if
it is not already completed.

Now that we have the controller teardown_lock, we can safely serialize
request cancellation. This addresses a hang caused by calling extra
queue freeze on controller namespaces, causing unfreeze to not complete
correctly.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/tcp.c