From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4ScB-0001hG-Dn for qemu-devel@nongnu.org; Mon, 05 Mar 2012 02:45:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4Sbm-0005XT-Uf for qemu-devel@nongnu.org; Mon, 05 Mar 2012 02:45:50 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:63682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4Sbm-0005Wq-LL for qemu-devel@nongnu.org; Mon, 05 Mar 2012 02:45:26 -0500 Received: by eaaf11 with SMTP id f11so613181eaa.4 for ; Sun, 04 Mar 2012 23:45:23 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4F546F0F.5050401@redhat.com> Date: Mon, 05 Mar 2012 08:45:19 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1330821863.17535.10.camel@Quad> In-Reply-To: <1330821863.17535.10.camel@Quad> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] NBD broken ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: qemu-devel@nongnu.org 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 > Date: Thu Sep 8 14:28:59 2011 +0200 > > nbd: switch to asynchronous operation > > Signed-off-by: Paolo Bonzini > > > 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} [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, [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