nvme: handle effects after freeing the request
authorKeith Busch <kbusch@kernel.org>
Mon, 19 Sep 2022 19:36:46 +0000 (12:36 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 27 Sep 2022 07:15:56 +0000 (09:15 +0200)
commitbc8fb906b0ff9339b4286698cb7cd9cd5b8c53eb
tree1bc98b4ceaa94bbe968f96c455003e7903aab1c8
parent99e603874366be1115b40ecbc0e25847186d84ea
nvme: handle effects after freeing the request

If a reset occurs after the scan work attempts to issue a command, the
reset may quisce the admin queue, which blocks the scan work's command
from dispatching. The scan work will not be able to complete while the
queue is quiesced.

Meanwhile, the reset work will cancel all outstanding admin tags and
wait until all requests have transitioned to idle, which includes the
passthrough request. But the passthrough request won't be set to idle
until after the scan_work flushes, so we're deadlocked.

Fix this by handling the end effects after the request has been freed.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216354
Reported-by: Jonathan Derrick <Jonathan.Derrick@solidigm.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chao Leng <lengchao@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/ioctl.c
drivers/nvme/host/nvme.h
drivers/nvme/target/passthru.c