Skip to content

nvmet: fix subtle race in I/O processing and ns configuration

Nilay Shroff linux-nvme lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 7 repliesIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Replace the XArray mark used to determine whether I/O should be admitted with an atomic bit. Using an XArray mark would touch significantly more cache lines in the I/O hot path than a simple bit test (hch)
- Introduce the NVMET_NS_IO_LIVE namespace flag to address the cache line overhead of using an XArray mark.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2nvmet: defer setting ns->enabled to false in nvmet_ns_disable()drivers/nvme/target/core.c drivers/nvme/target/nvmet.h+9 -54 replies
2/2nvmet: don't allow I/O admission after percpu ns reference is killeddrivers/nvme/target/core.c+12 -61 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigShin'ichiro Kawasaki
1/2R-b T-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] nvmet: fix subtle race in I/O processing and ns configuration

Hi,

This series addresses two race conditions in the nvmet core code that handles I/O submission and namespace configuration.

The first patch addresses a race where target namespace attributes could be changed while I/O is in progress. The second patch addresses a subtle race that could allow I/O to be admitted even after the percpu reference count has been killed or marked dead.

As usual, feedback, comments, and suggestions are most welcome!

Thanks!

Changes from v1:
- Replace the XArray mark used to determine whether I/O should be admitted with an atomic bit. Using an XArray mark would touch significantly more cache lines in the I/O hot path than a simple bit test (hch)
- Introduce the NVMET_NS_IO_LIVE namespace flag to address the cache line overhead of using an XArray mark.

Nilay Shroff (2):
nvmet: defer setting ns->enabled to false in nvmet_ns_disable()
nvmet: don't allow I/O admission after percpu ns reference is killed

 drivers/nvme/target/core.c  | 28 ++++++++++++++++++----------
 drivers/nvme/target/nvmet.h |  2 ++
 2 files changed, 20 insertions(+), 10 deletions(-)
Signature · 1 line
2.53.0