Received: from eggs.gnu.org ([2001:4830:134:3::10]:57588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b03kW-0005Vp-DX for qemu-devel@nongnu.org; Tue, 10 May 2016 05:14:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b03kQ-0003h7-IT for qemu-devel@nongnu.org; Tue, 10 May 2016 05:14:40 -0400 Date: Tue, 10 May 2016 11:14:22 +0200 From: Kevin Wolf Message-ID: <20160510091422.GG4921@noname.str.redhat.com> References: <1462848659-28659-1-git-send-email-famz@redhat.com> <20160510081425.GV1683@redhat.com> <20160510084303.GB28935@redhat.com> <20160510085041.GC13377@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160510085041.GC13377@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 00/27] block: Lock images when opening List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: "Richard W.M. Jones" , Fam Zheng , qemu-block@nongnu.org, Jeff Cody , Markus Armbruster , qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com, den@openvz.org, Max Reitz , John Snow Am 10.05.2016 um 10:50 hat Daniel P. Berrange geschrieben: > On Tue, May 10, 2016 at 09:43:04AM +0100, Richard W.M. Jones wrote: > > On Tue, May 10, 2016 at 09:14:26AM +0100, Richard W.M. Jones wrote: > > > However I didn't test the write-shareable case (the libvirt > > > flag which should map to a shared lock -- is that right Dan?). > > > > To Dan (mainly): I think setting the flag in libvirt only > > sets cache=unsafe on the qemu drive (it may have other effects for > > virtlockd). Should there be an extra qemu drive flag to communicate > > that the drive is write-shareable? > > Sure, if QEMU had a way to indicate that the disk was used in a > write-sharable mode, libvirt would use it. > > I agree with your general point that we should do no locking for > read-only access, F_RDLCK for shared-write and F_WRLCK for > exclusive-write access. I think I made that point similarly against > an earlier version of this patchset Why should we do no locking for read-only access by default? If an image is written to, read-only accesses are potentially inconsistent and we should protect users against it. The only argument I can see in the old versions of this series is "libguestfs does it and usually it gets away with it". For me, that's not an argument for generally allowing this, but at most for providing a switch to bypass the locking. Because let's be clear about this: If someone lost data because they took an inconsistent backup this way and comes to us qemu developers, all we can tell them is "sorry, what you did is not supported". And that's a pretty strong sign that locking should prevent it by default. Kevin