Skip to content

nvme: fixup race with namespace removal

Hannes Reinecke linux-nvme 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3nvme: do not quiesce or unquiesce invalid namespacesdrivers/nvme/host/core.c+8 -20 replies
2/3nvme: shorten race window in nvme_ns_remove()drivers/nvme/host/core.c+4 -45 replies
2/3nvme: shorten race window in nvme_ns_remove()drivers/nvme/host/core.c+1 -05 replies
2/3nvme: shorten race window in nvme_ns_remove()drivers/nvme/host/core.c drivers/nvme/host/rdma.c+1 -03 replies
2/3nvme: shorten race window in nvme_ns_remove()+0 -01 reply
3/3nvme-multipath: test namespace state when selecting a new pathdrivers/nvme/host/multipath.c+4 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] nvme: fixup race with namespace removal

Hi all,

nvme namespace scanning might race with controller reset, causing the system to crash in myriad ways if nvme_scan_ns_list() decides to remove a namespace while resetting is active on another thread.
The main problem here is that namespace removal is not atomic. The namespace mutex needs to be dropped before calling nvme_ns_remove(), so if nvme_ns_remove() is called while traversing the list of namespaces there always will be a race condition.

This patchset tries to fix this problem by shortening the race window and check for valid namespaces in nvme_start_queue()/nvme_stop_queue().

As usual, comments and reviews are welcome.

Hannes Reinecke (3):
nvme: do not quiesce or unquiesce invalid namespaces
nvme: shorten race window in nvme_ns_remove()
nvme-multipath: test namespace state when selecting a new path

 drivers/nvme/host/core.c      | 18 ++++++++++++------
 drivers/nvme/host/multipath.c |  6 ++++--
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 1 line
2.16.4