|
From: | Stefan Reiter |
Subject: | Re: [RFC PATCH 3/3] block: Assert we're running in the right thread |
Date: | Thu, 14 May 2020 15:52:03 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 5/12/20 4:43 PM, Kevin Wolf wrote:
tracked_request_begin() is called for most I/O operations, so it's a good place to assert that we're indeed running in the home thread of the node's AioContext.
Is this patch supposed to be always correct or only together with nr. 2?I changed our code to call bdrv_flush_all from the main AIO context and it certainly works just fine (even without this series, so I suppose that would be the 'correct' way to fix it you mention on the cover), though of course it trips this assert without patch 2.
Signed-off-by: Kevin Wolf <address@hidden> --- block/io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 7808e8bdc0..924bf5ba46 100644 --- a/block/io.c +++ b/block/io.c @@ -695,14 +695,17 @@ static void tracked_request_begin(BdrvTrackedRequest *req, uint64_t bytes, enum BdrvTrackedRequestType type) { + Coroutine *self = qemu_coroutine_self(); + assert(bytes <= INT64_MAX && offset <= INT64_MAX - bytes); + assert(bs->aio_context == qemu_coroutine_get_aio_context(self));*req = (BdrvTrackedRequest){.bs = bs, .offset = offset, .bytes = bytes, .type = type, - .co = qemu_coroutine_self(), + .co = self, .serialising = false, .overlap_offset = offset, .overlap_bytes = bytes,
[Prev in Thread] | Current Thread | [Next in Thread] |