qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Disk image shared and exclusive locks.


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH] Disk image shared and exclusive locks.
Date: Mon, 7 Dec 2009 14:01:32 +0000
User-agent: Mutt/1.4.1i

On Mon, Dec 07, 2009 at 07:43:53AM -0600, Anthony Liguori wrote:
> Daniel P. Berrange wrote:
> >That doesn't work in the case of setting up a clustered filesystem
> >shared between guests. That requires that the disk be opened writable,
> >but with a shared (F_RDLOCK) lock.
> >  
> 
> If you'd like data corruption :-)
> 
> qemu -drive file=/dev/hda,lock=shared   # clustered file system
> qemu -drive file=/dev/hda,lock=shared   # clustered file system
> 
> qemu -drive file=/dev/hda,lock=shared -snapshot  # i have no awareness 
> of the last two.
> 
> The 3rd invocation is totally fine.  /dev/hda is shared (but the 
> expectation is read-only).

> Better to stick with on/off.  That gives much easier to understand 
> semantics.

The 3rd invocation is not changing the backing file, so it is not causing
data corruption on the master file. Sure the 3rd OS instance will probably
crash & get confused because its backing file is changing under its feet
but as long as 'commit' isn't used, it is still safe. 'commit' should 
require that the disk have been locked in exclusive  mode from the time
it started. It is not safe to merely let it upgrade the lock from
shared to exclusive at time of committing because of this exact scenario.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]