qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Disk image shared and exclusive locks.
Date: Mon, 07 Dec 2009 07:39:11 -0600	[thread overview]
Message-ID: <4B1D057F.9000708@codemonkey.ws> (raw)
In-Reply-To: <20091207105855.GK23109@amd.home.annexia.org>

Richard W.M. Jones wrote:
> On Sat, Dec 05, 2009 at 11:47:11AM -0600, Anthony Liguori wrote:
>   
>> I think I made my point poorly.  Consider the following:
>>
>> qemu-img create -f raw base.img 10G
>> qemu-img create -f qcow2 -b base.img cow1.img
>> qemu-img create -f qcow2 -b base.img cow2.img
>>
>> qemu -drive file=cow1.img,lock=exclusive
>> qemu -drive file=cow2.img,lock=exclusive
>>
>> With the current patch, the second command will fail and it's impossible  
>> to invoke correctly.  That's because flags are passed down to backing  
>> devices directly.
>>     
>
> Isn't it correct that the second command fails?  Although the base
> image is mostly used read-only, if the user does the "commit" command
> in the monitor then the backing image is overwritten.  (That's my
> understanding of the documentation anyway - I've never actually used
> this feature of qcow2).
>   

That's a use-case that needs to be thought through.  Maybe commit should 
attempt to force the lower level to acquire a write lock first?

The above use-case is extremely common so it's something that's worth 
supporting.

> Also if we only acquire the lock during the commit operation then
> we'll end up with disk corruption.

Why do we end up with disk corruption?

If someone else has the backing file open with a read lock, we won't be 
able to acquire the write lock.  Once we've acquired the write lock, no 
one can acquire the read lock.  Once we've released the write lock 
(after an fsync of  course), we won't touch it again.

Regards,

Anthony Liguori

  parent reply	other threads:[~2009-12-07 13:39 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                           ` [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 [this message]
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=4B1D057F.9000708@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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).