]> git.proxmox.com Git - mirror_qemu.git/commit
nbd: do not block in nbd_wr_sync if no data at all is available
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 5 Mar 2012 08:10:35 +0000 (09:10 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 19 Apr 2012 14:36:43 +0000 (16:36 +0200)
commit7fe7b68b32ba609faeeee03556aac0eb1b187c91
tree87877a95bedeae58e0232c12459608b1bdb4128f
parent185b43386ad999c80bdc58e41b87f05e5b3e8463
nbd: do not block in nbd_wr_sync if no data at all is available

Right now, nbd_wr_sync will hang if no data at all is available on the
socket and the other side is not going to provide any.  Relax this by
making it loop only for writes or partial reads.  This fixes a race
where one thread is executing qemu_aio_wait() and another is executing
main_loop_wait().  Then, the select() call in main_loop_wait() can return
stale data and call the "readable" callback with no data in the socket.

Reported-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block/nbd.c
nbd.c