]> git.baikalelectronics.ru Git - kernel.git/commit
NVMe: Fix reset/remove race
authorKeith Busch <keith.busch@intel.com>
Fri, 8 Apr 2016 22:11:02 +0000 (16:11 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 11 Apr 2016 16:00:04 +0000 (10:00 -0600)
commit1c938636cb9ed4b9ae9154a8ec85a535b8de2bf8
tree3ad6e0a0d24a9afff0b3c6cc426e606d8fa75cf6
parentc310a4193867e6757cd28042d43c729dfdb2c498
NVMe: Fix reset/remove race

This fixes a scenario where device is present and being reset, but a
request to unbind the driver occurs.

A previous patch series addressing a device failure removal scenario
flushed reset_work after controller disable to unblock reset_work waiting
on a completion that wouldn't occur. This isn't safe as-is. The broken
scenario can potentially be induced with:

  modprobe nvme && modprobe -r nvme

To fix, the reset work is flushed immediately after setting the controller
removing flag, and any subsequent reset will not proceed with controller
initialization if the flag is set.

The controller status must be polled while active, so the watchdog timer
is also left active until the controller is disabled to cleanup requests
that may be stuck during namespace removal.

[Fixes: 988b1f84dc3dbc42b0459c54f03dc15f46ac87d5]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/pci.c