]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: fix possible io failures when removing multipathed ns
authorAnton Eidelman <anton@lightbitslabs.com>
Thu, 20 Jun 2019 06:48:10 +0000 (08:48 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 Jun 2019 09:08:38 +0000 (11:08 +0200)
commit091860e09a8bd0b6672a19c86ae7458de4b3055d
tree3c3e8132083043b5a220b0ad6b96b4b50dfccc7b
parent2ed0afa13423f8f3588313e019c328c9a6323658
nvme: fix possible io failures when removing multipathed ns

When a shared namespace is removed, we call blk_cleanup_queue()
when the device can still be accessed as the current path and this can
result in submission to a dying queue. Hence, direct_make_request()
called by our mpath device may fail (propagating the failure to userspace).
Instead, we want to failover this I/O to a different path if one exists.
Thus, before we cleanup the request queue, we make sure that the device is
cleared from the current path nor it can be selected again as such.

Fix this by:
- clear the ns from the head->list and synchronize rcu to make sure there is
  no concurrent path search that restores it as the current path
- clear the mpath current path in order to trigger a subsequent path search
  and sync srcu to wait for any ongoing request submissions
- safely continue to namespace removal and blk_cleanup_queue

Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c