From: "Richard W.M. Jones" <rjones@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Disk image shared and exclusive locks.
Date: Fri, 4 Dec 2009 21:57:07 +0000 [thread overview]
Message-ID: <20091204215517.GA5938@amd.home.annexia.org> (raw)
In-Reply-To: <4B1943A0.7030509@codemonkey.ws>
On Fri, Dec 04, 2009 at 11:15:12AM -0600, Anthony Liguori wrote:
> Richard W.M. Jones wrote:
>> [from the commit message ...]
>>
>> Allow qemu to acquire shared and exclusive locks on disk images.
>> This is done by extending the -drive option with an additional,
>> optional parameter:
>>
>> -drive [...],lock=none
>> -drive [...],lock=shared
>> -drive [...],lock=exclusive
>>
>> lock=none is the default, and it means that we don't try to acquire
>> any sort of lock.
>>
>> lock=shared tries to acquire a shared lock on the disk image.
>> Multiple instances of qemu may all hold this sort of lock.
>>
>> lock=exclusive tries to acquire an exclusive lock on the disk
>> image. An exclusive lock excludes all other shared and exclusive
>> locks.
>>
>> If acquisition of a lock fails, opening the image fails.
>>
>> The implementation of locks only works for raw POSIX and Win32
>> files. However many of the other block types are implemented
>> in terms of these drivers, so they "inherit" locking too. Other
>> drivers are read-only, so don't require locking. Below we note
>> only the cases where locking is *not* implemented:
>>
>> cloop - directly open()s the file, no locking implemented
>> cow - same as cloop
>> curl - protocol probably doesn't support locking
>> nbd - same as curl
>>
>
> The problem with something like this is that it gives a false sense of
> security.
>
> You can still run into problems if you have an application accessing the
> image that doesn't attempt to acquire the lock.
The idea would be for management tools (eg. libvirt) to add the lock
parameter for all virtual machines that they manage.
I don't see how this is worse than what we have now -- ie. no
possibility of locking at all and a very real risk of disk corruption.
Anyway, we could make the locking mandatory. I believe that the
locking under Win32 (using LockFileEx) is already mandatory. With
mandatory locks it would be pretty watertight in the single node case.
Alternatively how about making lock=exclusive the default?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
next prev parent reply other threads:[~2009-12-04 21:57 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 16:53 [Qemu-devel] [PATCH] Disk image shared and exclusive locks Richard W.M. Jones
2009-12-04 17:15 ` Anthony Liguori
2009-12-04 21:57 ` Richard W.M. Jones [this message]
2009-12-04 22:29 ` Anthony Liguori
2009-12-05 17:31 ` Avi Kivity
2009-12-05 17:47 ` Anthony Liguori
2009-12-05 17:55 ` Avi Kivity
2009-12-05 17:59 ` Anthony Liguori
2009-12-07 10:31 ` Jamie Lokier
2009-12-07 10:42 ` Kevin Wolf
2009-12-07 10:48 ` Avi Kivity
2009-12-07 10:56 ` Kevin Wolf
2009-12-07 11:28 ` Jamie Lokier
2009-12-07 11:51 ` Kevin Wolf
2009-12-07 12:06 ` Daniel P. Berrange
2009-12-07 10:45 ` Daniel P. Berrange
2009-12-07 11:19 ` Jamie Lokier
2009-12-07 11:30 ` Daniel P. Berrange
2009-12-07 11:31 ` Richard W.M. Jones
2009-12-07 11:38 ` Jamie Lokier
2009-12-07 11:49 ` Daniel P. Berrange
2009-12-07 11:59 ` Richard W.M. Jones
2009-12-07 14:35 ` [Qemu-devel] " Paolo Bonzini
2009-12-07 13:43 ` [Qemu-devel] " Anthony Liguori
2009-12-07 14:01 ` Daniel P. Berrange
2009-12-07 14:15 ` Anthony Liguori
2009-12-07 14:28 ` Daniel P. Berrange
2009-12-07 14:53 ` Anthony Liguori
2009-12-08 9:40 ` Kevin Wolf
2009-12-07 11:04 ` Richard W.M. Jones
2009-12-07 10:58 ` Richard W.M. Jones
2009-12-07 11:35 ` Jamie Lokier
2009-12-07 13:39 ` Anthony Liguori
2009-12-07 14:08 ` Richard W.M. Jones
2009-12-07 14:22 ` Anthony Liguori
2009-12-07 14:31 ` Richard W.M. Jones
2009-12-07 14:55 ` Anthony Liguori
2009-12-08 9:48 ` Kevin Wolf
2009-12-08 10:16 ` Richard W.M. Jones
2009-12-07 14:38 ` [Qemu-devel] " Paolo Bonzini
2009-12-07 9:38 ` [Qemu-devel] " Daniel P. Berrange
2009-12-07 10:39 ` Chris Webb
2009-12-07 13:32 ` Anthony Liguori
2009-12-07 13:38 ` Chris Webb
2009-12-07 13:47 ` Anthony Liguori
2009-12-07 14:25 ` Daniel P. Berrange
2009-12-07 14:58 ` Chris Webb
2009-12-07 14:16 ` [Qemu-devel] [PATCH VERSION 2] " Richard W.M. Jones
2009-12-07 15:06 ` Anthony Liguori
2009-12-08 8:48 ` [Qemu-devel] " Paolo Bonzini
2009-12-08 10:00 ` [Qemu-devel] " Kevin Wolf
2009-12-08 10:25 ` Richard W.M. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091204215517.GA5938@amd.home.annexia.org \
--to=rjones@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).