diff options
-rw-r--r-- | block.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -2303,14 +2303,15 @@ static bool tracked_request_overlaps(BdrvTrackedRequest *req, return true; } -static void coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) +static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) { BlockDriverState *bs = self->bs; BdrvTrackedRequest *req; bool retry; + bool waited = false; if (!bs->serialising_in_flight) { - return; + return false; } do { @@ -2336,11 +2337,14 @@ static void coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) qemu_co_queue_wait(&req->wait_queue); self->waiting_for = NULL; retry = true; + waited = true; break; } } } } while (retry); + + return waited; } /* @@ -3191,6 +3195,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; + bool waited; int ret; int64_t sector_num = offset >> BDRV_SECTOR_BITS; @@ -3199,7 +3204,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); - wait_serialising_requests(req); + waited = wait_serialising_requests(req); + assert(!waited || !req->serialising); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req); @@ -3299,9 +3305,11 @@ static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, QEMUIOVector tail_qiov; struct iovec tail_iov; size_t tail_bytes; + bool waited; mark_request_serialising(&req, align); - wait_serialising_requests(&req); + waited = wait_serialising_requests(&req); + assert(!waited || !use_local_qiov); tail_buf = qemu_blockalign(bs, align); tail_iov = (struct iovec) { |