Skip to content

block: protect BlockBackend->queued_requests with a lock

Stefan Hajnoczi qemu-devel 2 versions – Applied

Status from this message: Thanks, applied to the block-next branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 8 repliesApplied
  2. v13 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Use qatomic_fetch_inc/dec() for readability in Patch 1 [Hanna]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3block: make BlockBackend->quiesce_counter atomicblock/block-backend.c+7 -71 reply
2/3block: make BlockBackend->disable_request_queuing atomicblock/block-backend.c+4 -36 replies
3/3block: protect BlockBackend->queued_requests with a lockblock/block-backend.c+16 -20 replies

Reviews trailers per patch

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

PatchHanna CzenczekPhilippe Mathieu-Daudé
1/3R-b
2/3R-b R-b
3/3R-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/3] block: protect BlockBackend->queued_requests with a lock

v2:
- Use qatomic_fetch_inc/dec() for readability in Patch 1 [Hanna]

QEMU block layer multi-queue support involves running I/O requests from multiple threads. Shared state must be protected somehow to avoid thread-safety issues.

The BlockBackend->queued_requests CoQueue is accessed without a lock and will likely be corrupted when multiple threads queue requests at the same time.

This patch series make BlockBackend->queued_requests thread-safe.

Stefan Hajnoczi (3):
block: make BlockBackend->quiesce_counter atomic
block: make BlockBackend->disable_request_queuing atomic
block: protect BlockBackend->queued_requests with a lock

 block/block-backend.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
Signature · 1 line
2.39.2