Received: from eggs.gnu.org ([2001:4830:134:3::10]:54710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBiL4-0000L8-Qw for qemu-devel@nongnu.org; Wed, 23 Dec 2015 07:16:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBiL1-00063C-DJ for qemu-devel@nongnu.org; Wed, 23 Dec 2015 07:16:18 -0500 Received: from relay.parallels.com ([195.214.232.42]:56756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBiL1-0005yh-4t for qemu-devel@nongnu.org; Wed, 23 Dec 2015 07:16:15 -0500 Date: Wed, 23 Dec 2015 15:15:50 +0300 From: Roman Kagan Message-ID: <20151223121549.GA6247@rkaganb.sw.ru> References: <1450802786-20893-1-git-send-email-kwolf@redhat.com> <20151223031412.GC14423@ad.usersys.redhat.com> <20151223104722.GB20028@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20151223104722.GB20028@redhat.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 00/10] qcow2: Implement image locking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com On Wed, Dec 23, 2015 at 10:47:22AM +0000, Daniel P. Berrange wrote: > On Wed, Dec 23, 2015 at 11:14:12AM +0800, Fam Zheng wrote: > > As an alternative, can we introduce .bdrv_flock() in protocol drivers, with > > similar semantics to flock(2) or lockf(3)? That way all formats can benefit, > > and a program crash will automatically drop the lock. > > FWIW, the libvirt locking daemon (virtlockd) will already attempt to take > out locks using fcntl()/lockf() on all disk images associated with a VM. Is it even possible without QEMU cooperating? In particular in complex cases with e.g. backing chains? This was exactly the reason why we designed the "lock" option to take an argument describing the locking mechanism to be used (see the tentative patchset Denis posted in this thread). The only one currently implemented is flock()-based; however it can be extended to other mechanisms like network / cluster / SAN lock managers, etc. In particular, it can be made to talk to virtlockd. Roman.