From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK7sO-0005Kd-MO for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:28:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK7sK-00046C-6l for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:28:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK7sJ-000467-UG for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:28:04 -0400 Date: Thu, 12 Sep 2013 16:27:50 +0200 From: Kevin Wolf Message-ID: <20130912142750.GK3514@dhcp-200-207.str.redhat.com> References: <5231A524.2080103@profitbricks.com> <20130912135836.GE18070@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130912135836.GE18070@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [RFC] O_EXCL or not open block device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: NeilBrown , Jack Wang , Paolo Bonzini , Dongsu Park , qemu-devel Am 12.09.2013 um 15:58 hat Stefan Hajnoczi geschrieben: > On Thu, Sep 12, 2013 at 01:27:32PM +0200, Jack Wang wrote: > > Hi all, > > > > We're using qemu export md-raid to guest OS, and we saw deadlock on > > MD(which is already fixed by Neil), please see thread below: > > > http://marc.info/?l=linux-raid&m=137894040228125&w=2 > > > > As Neil suggested it would be good for userspace applications to call > > open() with O_EXCL flag, to avoid such MD hanging problems at the begining. > > > > And we checked qemu, it looks it doesn't include O_EXCL flag when open > > block device. > > > > After search in the mail list we found there are a similar discussion: > > > > https://lists.nongnu.org/archive/html/qemu-devel/2011-04/msg00722.html > > > > > To O_EXCL or not to O_EXCL open host_cdrom > > > > Which looks prefer enable O_EXCL, but I checked latest qemu tree, there > > no such code, could anyone give comments on this? > > Continuing from that discussion, I think the shared CD-ROM case is > something we must avoid breaking. It worked in the past so it shouldn't > break in a new QEMU version. > > Kevin: Do you think we should add an option to the host_device > BlockDriver that sets the O_EXCL open flag? That way users and new > libvirt can use O_EXCL for host block devices. > > The simpler alternative is to always use O_EXCL for non-CDROM host > devices. Simple patch, no configuration required, but it means we > continue to lack O_EXCL on CD-ROMs. I'm not sure why O_EXCL would be correct on generic block devices when it's wrong on CD-ROMs. I think it's in fact more likely that other devices are shared, as backing files. Adding an option is certainly possible, but what would the default be? If O_EXCL is off by default, would anyone actually use it? Kevin