qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Bug 1721788 <1721788@bugs.launchpad.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Bug 1721788] [NEW] Failed to get shared "write" lock with 'qemu-img info'
Date: Fri, 6 Oct 2017 09:28:48 -0500	[thread overview]
Message-ID: <5faae65d-7ab6-cc96-c85f-19f5514f8f8a@redhat.com> (raw)
In-Reply-To: <150729895903.22243.5921581973131047310.malonedeb@gac.canonical.com>

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

On 10/06/2017 09:09 AM, Jan Heidbrink wrote:
> Public bug reported:
> 
> When running 'qemu-img info test.qcow2' while test.qcow2 is currently
> used by a Qemu process, I get the error
> 
> qemu-img: Could not open 'test.qcow2': Failed to get shared "write"
> lock.
> 
> 
> Why does displaying information about a disk image need a write lock for the file?

Because there is a risk (albeit rather slight) that what you read from
the disk is inconsistent due to being an intermediate state in-between
separate non-atomic write actions by the other process that has it open
for write.

If you are willing to ignore the risk, then use:

qemu-img info -U test.qcow2

which says that you are okay reading the image while it is shared with a
concurrent writer, even if the read fails spectacularly in the unlikely
case that it sees inconsistent information.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


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

  parent reply	other threads:[~2017-10-06 14:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 14:09 [Qemu-devel] [Bug 1721788] [NEW] Failed to get shared "write" lock with 'qemu-img info' Jan Heidbrink
2017-10-06 14:28 ` [Qemu-devel] [Bug 1721788] " Daniel Berrange
2017-10-06 14:28 ` Eric Blake [this message]
2017-10-06 14:30 ` Daniel Berrange
2017-10-11 20:46   ` Liang Yan
2021-04-22  5:29 ` Thomas Huth
2021-04-22  8:14 ` Jan Heidbrink
2021-04-22 11:05 ` Max Reitz
2021-04-23 13:43 ` Jan Heidbrink
2022-04-19 14:35 ` Kaitlyn Lew

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=5faae65d-7ab6-cc96-c85f-19f5514f8f8a@redhat.com \
    --to=eblake@redhat.com \
    --cc=1721788@bugs.launchpad.net \
    --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).