From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] Disk image shared and exclusive locks.
Date: Mon, 07 Dec 2009 15:35:36 +0100 [thread overview]
Message-ID: <hfj3ro$850$1@ger.gmane.org> (raw)
In-Reply-To: <20091207114932.GL24530@redhat.com>
> Now an admin comes along with with libguestfs and attempts to access
> the disk containing the GFS volume. libguestfs isn't part of the
> cluster but that doesn't matter because you can happily access a GFS
> filesystem in standalone mode provided it is not in use by any other
> nodes.
>
> We need to stop libguestfs opening the disk in exclusive-write mode
> if other QEMU VMs are using it in shared-write mode.
I think it's simpler to use no locking in QEMU and let the cluster
management tool do the locking. The tool would be the one to invoke
QEMU, of course.
> If QEMU with the shared-writable disks is been using F_RDLOCK, then
> this would have prevent libguestfs opening the disk for write with
> F_WRLOCK, since the F_RDLOCK blocks all F_WRLOCK attempts.
>
> We really do have 3 combinations of locking / access mode here
>
> - read-only + F_RDLOCK
> - read-write + F_RDLOCK
> - read-write + F_WRLOCK
>
> So a single 'lock' flag is not sufficient, we need the shared/exclusive
> semantics of the original patch.
I'd still prefer having a DWIM lock option that chooses the right kind
of locking depending on what you are doing.
You could have lock={no,yes,shared,exclusive} as follows
image type lock=no yes shared exclusive
raw, opened RO no F_RDLOCK F_RDLOCK F_WRLOCK
raw, opened RW no F_WRLOCK F_RDLOCK F_WRLOCK
qcow2, opened RO no F_RDLOCK F_RDLOCK F_WRLOCK
backing image no F_RDLOCK F_RDLOCK F_WRLOCK
qcow2, opened RW no F_WRLOCK error F_WRLOCK
backing image no F_RDLOCK error F_WRLOCK
However, I think lock=shared would be the wrong thing to do in the
cluster case. It's better if the management tool locks the partitions
for read-write instead, and this clearly does not belong in QEMU. It
would be a step in the wrong direction, and one that will be there
forever in QEMU.
I think only lock={no,yes} is the best option to start with.
Paolo
next prev parent reply other threads:[~2009-12-07 14:36 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
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 ` Paolo Bonzini [this message]
2009-12-07 13:43 ` 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='hfj3ro$850$1@ger.gmane.org' \
--to=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.