qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Documentation: Warn against qemu-img on active image
Date: Thu, 16 Aug 2012 07:49:18 -0600	[thread overview]
Message-ID: <502CFA5E.50900@redhat.com> (raw)
In-Reply-To: <502CF711.2060000@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]

On 08/16/2012 07:35 AM, Kevin Wolf wrote:
> Am 16.08.2012 14:56, schrieb Eric Blake:
>> On 08/16/2012 04:00 AM, Peter Maydell wrote:
>>> On 16 August 2012 10:00, Kevin Wolf <kwolf@redhat.com> wrote:
>>>> People have repeatedly expected that you can do things like snapshotting
>>>> an image with qemu-img while a qemu instance is running. Maybe we need
>>>> to consider locking the files while they are in use,
>>
>> Sounds like a nice feature bit to add to qcow2v3, where both qemu-img
>> and qemu check if the locking feature is enabled for an image, as well
>> as maintain a header bit that is set when the image is open read-write
>> and refuse to use the image if the lock bit is set.
> 
> I thought the same. However, then you need some way to override this
> mechanism when recovering from a crash etc., so it's not a trivial
> addition and it would be user-visible.

Good point.  With fcntl() locking, the lock goes away on crash; but with
file modification locking, the lock can get stuck so you have to provide
overrides; and once you provide overrides, the lock is not quite as
powerful.  So maybe it's best to just leave locking up to management
apps (after all, libvirt already has a lock protocol support, currently
built on sanlock but also with a patch proposed for using fcntl()).

>> Is this strong enough?  Remember, with qcow2v3 and qed, the mere act of
>> opening an image will perform refcount checks that modify the image,
>> unless you explicitly request otherwise, which means even a query of the
>> file metadata may result in modifying the image as part of the default
>> open. 
> 
> Not for read-only opens. I think qemu-img gets this right meanwhile, so
> that images are opened read-only when they are only queried.

Then it might also be worth documenting which actions are read-only
queries vs. potential modifications, in the docs for each action.  (For
example, 'info' is read-only, 'convert' is read-only when creating a
copy although consistency is essential for it to be useful, 'check' is
readonly while 'check -r' is read-write,...)

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

      reply	other threads:[~2012-08-16 13:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  9:00 [Qemu-devel] [PATCH] Documentation: Warn against qemu-img on active image Kevin Wolf
2012-08-16 10:00 ` Peter Maydell
2012-08-16 12:56   ` Eric Blake
2012-08-16 13:35     ` Kevin Wolf
2012-08-16 13:49       ` Eric Blake [this message]

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=502CFA5E.50900@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).