]> asedeno.scripts.mit.edu Git - linux.git/commit
nvme_fc: fix ctrl create failures racing with workq items
authorJames Smart <jsmart2021@gmail.com>
Tue, 13 Mar 2018 16:48:07 +0000 (09:48 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2018 14:53:43 +0000 (08:53 -0600)
commitcf25809bec2c7df4b45df5b2196845d9a4a3c89b
treee8c8fe8542d18c738af31cc9f4b61a785aabd3c9
parent467c77d4cbefaaf65e2f44fe102d543a52fcae5b
nvme_fc: fix ctrl create failures racing with workq items

If there are errors during initial controller create, the transport
will teardown the partially initialized controller struct and free
the ctlr memory.  Trouble is - most of those errors can occur due
to asynchronous events happening such io timeouts and subsystem
connectivity failures. Those failures invoke async workq items to
reset the controller and attempt reconnect.  Those may be in progress
as the main thread frees the ctrl memory, resulting in NULL ptr oops.

Prevent this from happening by having the main ctrl failure thread
changing state to DELETING followed by synchronously cancelling any
pending queued work item. The change of state will prevent the
scheduling of resets or reconnect events.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/fc.c