[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] nbd: make client_close synchronous
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 3/4] nbd: make client_close synchronous |
Date: |
Mon, 29 Jun 2020 14:56:16 +0100 |
On Mon, Jun 29, 2020 at 10:55:06AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Also, why in block/io.c we kick the main context, but not bs->aio_context?
>From AIO_WAIT_WHILE():
* The caller's thread must be the IOThread that owns @ctx or the main loop
* thread (with @ctx acquired exactly once). This function cannot be used to
* wait on conditions between two IOThreads since that could lead to deadlock,
* go via the main loop instead.
Case 1: IOThread
while ((cond)) { \
aio_poll(ctx_, true); \
waited_ = true; \
} \
In this case aio_poll() returns after every event loop iteration and we
will re-evaluate cond. Therefore we don't need to be kicked.
Case 2: Main loop thread
In this case we need the kick since we're waiting on the main loop
AioContext, not the IOThread AioContext that is doing the actual work.
aio_wait_kick() schedules a dummy BH to wake up the main loop thread.
There is no harm in scheduling the dummy BH in the main loop thread when
AIO_WAIT_WHILE() is called from an IOThread.
Hope this helps,
Stefan
signature.asc
Description: PGP signature
- [PATCH 0/4] Fix crash due to NBD export leak, Vladimir Sementsov-Ogievskiy, 2020/06/25
- [PATCH 1/4] iotests: QemuIoInteractive: use qemu_io_args_no_fmt, Vladimir Sementsov-Ogievskiy, 2020/06/25
- [PATCH 2/4] iotests.py: QemuIoInteractive: print output on failure, Vladimir Sementsov-Ogievskiy, 2020/06/25
- [PATCH 3/4] nbd: make client_close synchronous, Vladimir Sementsov-Ogievskiy, 2020/06/25
- [PATCH 4/4] iotests: test shutdown when bitmap is exported through NBD, Vladimir Sementsov-Ogievskiy, 2020/06/25
- Re: [PATCH 0/4] Fix crash due to NBD export leak, no-reply, 2020/06/25