From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRKI3-0007MX-Qb for qemu-devel@nongnu.org; Fri, 18 Nov 2011 03:59:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRKI2-00042p-Qo for qemu-devel@nongnu.org; Fri, 18 Nov 2011 03:59:19 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:45388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRKI2-00042i-Iu for qemu-devel@nongnu.org; Fri, 18 Nov 2011 03:59:18 -0500 Received: by iakk32 with SMTP id k32so3740319iak.4 for ; Fri, 18 Nov 2011 00:59:17 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4EC61E60.2040405@redhat.com> Date: Fri, 18 Nov 2011 09:59:12 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1321529765-14863-1-git-send-email-cyliu@suse.com> <4EC50F0F.3020400@redhat.com> <4EC64EC90200006600006BCD@novprvlin0050.provo.novell.com> In-Reply-To: <4EC64EC90200006600006BCD@novprvlin0050.provo.novell.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] Add -f option to qemu-nbd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Chunyan Liu On 11/18/2011 02:25 AM, Chun Yan Liu wrote: > Yes. I have tested using same device twice as described in my previous > mail. Without lock: > > If issuing "qemu-nbd -c /dev/nbd0 disk.img" and "qemu-nbd -c /dev/nbd0 > disk1.img" almost at the same time, both can pass nbd_init() and get to > nbd_client(), then the latter one will fail and exit, but the first one > does not work well either (fail to show partitions.) That's why I think > we should add a lock in an earlier time. This is an initialization problem. As Stefan wrote, functionality for atomic acquisition of NBD devices is provided by the kernel; the problem is simply that QEMU does not use it. :) Paolo