diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2017-06-01 12:44:56 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-06-07 18:22:02 +0200 |
commit | 6bdcc018a6ed760b9dfe43539124e420aed83092 (patch) | |
tree | 28864efb950ffa58600716b6890f1eb672cd6542 /qemu-nbd.c | |
parent | b8158192fadb3e346372456c25cbbc4be584a85c (diff) | |
download | qemu-6bdcc018a6ed760b9dfe43539124e420aed83092.zip qemu-6bdcc018a6ed760b9dfe43539124e420aed83092.tar.gz qemu-6bdcc018a6ed760b9dfe43539124e420aed83092.tar.bz2 |
nbd: make it thread-safe, fix qcow2 over nbd
NBD is not thread safe, because it accesses s->in_flight without
a CoMutex. Fixing this will be required for multiqueue.
CoQueue doesn't have spurious wakeups but, when another coroutine can
run between qemu_co_queue_next's wakeup and qemu_co_queue_wait's
re-locking of the mutex, the wait condition can become false and
a loop is necessary.
In fact, it turns out that the loop is necessary even without this
multi-threaded scenario. A particular sequence of coroutine wakeups
is happening ~80% of the time when starting a guest with qcow2 image
served over NBD (i.e. qemu-nbd --format=raw, and QEMU's -drive option
has -format=qcow2). This patch fixes that issue too.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-nbd.c')
0 files changed, 0 insertions, 0 deletions