]> git.itanic.dy.fi Git - linux-stable/commit
nvme-pci: fix rapid add remove sequence
authorKeith Busch <keith.busch@intel.com>
Thu, 24 Jan 2019 01:46:11 +0000 (18:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:04:17 +0000 (14:04 -0700)
commitc13a99fe8c6d9d5ff85f7a90dcca07a3cbd4a0ba
tree5697b54b92040edae1471a9af122c681c77a4b02
parent6791cbc4f57215bb7de561e2ae1603a547b26149
nvme-pci: fix rapid add remove sequence

[ Upstream commit 5c959d73dba6495ec01d04c206ee679d61ccb2b0 ]

A surprise removal may fail to tear down request queues if it is racing
with the initial asynchronous probe. If that happens, the remove path
won't see the queue resources to tear down, and the controller reset
path may create a new request queue on a removed device, but will not
be able to make forward progress, deadlocking the pci removal.

Protect setting up non-blocking resources from a shutdown by holding the
same mutex, and transition to the CONNECTING state after these resources
are initialized so the probe path may see the dead controller state
before dispatching new IO.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=202081
Reported-by: Alex Gagniuc <Alex_Gagniuc@Dellteam.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Tested-by: Alex Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/pci.c