diff options
| author | Paolo Bonzini | 2022-04-14 19:57:52 +0200 |
|---|---|---|
| committer | Eric Blake | 2022-04-26 20:16:37 +0200 |
| commit | ee19d953ecff53908a645d38a1b913fdf15a72f4 (patch) | |
| tree | e85205cb70e809688b4c694a0c497a33891642a9 /python | |
| parent | nbd: keep send_mutex/free_sema handling outside nbd_co_do_establish_connection (diff) | |
| download | qemu-ee19d953ecff53908a645d38a1b913fdf15a72f4.tar.gz qemu-ee19d953ecff53908a645d38a1b913fdf15a72f4.tar.xz qemu-ee19d953ecff53908a645d38a1b913fdf15a72f4.zip | |
nbd: use a QemuMutex to synchronize yanking, reconnection and coroutines
The condition for waiting on the s->free_sema queue depends on
both s->in_flight and s->state. The latter is currently using
atomics, but this is quite dubious and probably wrong.
Because s->state is written in the main thread too, for example by
the yank callback, it cannot be protected by a CoMutex. Introduce a
separate lock that can be used by nbd_co_send_request(); later on this
lock will also be used for s->state. There will not be any contention
on the lock unless there is a yank or reconnect, so this is not
performance sensitive.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220414175756.671165-6-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Lukas Straub <lukasstraub2@web.de>
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'python')
0 files changed, 0 insertions, 0 deletions
