Il 04/03/2012 01:44, Laurent Vivier ha scritto:
> Hi,
> 
> since commit ae255e523, qemu with NBD hangs at startup (when it tries to
> access the disk):
> 
> commit ae255e523c256cf0708f1c16cb946ff96340a800
> Author: Paolo Bonzini <[email protected]>
> Date:   Thu Sep 8 14:28:59 2011 +0200
> 
>     nbd: switch to asynchronous operation
>     
>     Signed-off-by: Paolo Bonzini <[email protected]>
> 
> 
> Reverting this patch corrects the problem.
> 
> My system is an Ubuntu 11.04 x86_64 (But the bug is also seen on RHEL6).
> 
> qemu is configured only with "--target-list=x86_64-softmmu".
> 
> My test case is:
> 
> ./qemu-nbd -k /tmp/nbd-socket -t /ISO/ubuntu-11.04-desktop-i386.iso
> 
> ./x86_64-softmmu/qemu-system-x86_64 -cdrom nbd:unix:/tmp/nbd-socket
> 
> Same problem with a TCP socket, with/without KVM, with an x86_64 guest, with 
> -hda...

I can reproduce it.  I'm pretty sure it worked when I posted the patch,
though of course I may be wrong.  Perhaps I just didn't test IDE: virtio works.

It's a race:

[pid 17045] select(13, [0 3 4 6 8 12], [], [], {1, 0} <unfinished ...>
[pid 17046] sendmsg(6, {msg_name(0)=NULL, msg_iov(1)=[{"...", 28}], ...}, 0) = 
28
[pid 17046] select(7, [0 6], [], NULL, NULL) = 1 (in [6])
[pid 17045] <... select resumed> )      = 1 (in [6], left {0, 986176})
[pid 17046] recvfrom(6,  <unfinished ...>
[pid 17046] <... recvfrom resumed> "...", 16, 0, NULL, NULL) = 16
[pid 17046] recvmsg(6, {msg_name(0)=NULL, msg_iov(1)=[{"..." 512}], ...}, 0) = 
512
[pid 17045] recvfrom(6, 0x7fff5fee29d0, 16, 0, 0, 0) = -1 EAGAIN (Resource 
temporarily unavailable)
[pid 17045] recvfrom(6, 0x7fff5fee29d0, 16, 0, 0, 0) = -1 EAGAIN (Resource 
temporarily unavailable)
[pid 17045] recvfrom(6, 0x7fff5fee29d0, 16, 0, 0, 0) = -1 EAGAIN (Resource 
temporarily unavailable)

Two selects return a readable state at the same time, and when the second
handler is called it fails to retrieve the NBD header.

Paolo

Reply via email to