qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Jakob Bohm <jb-gnumlists@wisemo.com>
Cc: "John Snow" <jsnow@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Qemu-block <qemu-block@nongnu.org>,
	qemu-discuss@nongnu.org
Subject: Re: Which qemu change corresponds to RedHat bug 1655408
Date: Mon, 12 Oct 2020 09:22:31 +0200	[thread overview]
Message-ID: <a559a19b-f02d-214b-18b7-d7af5b06a251@redhat.com> (raw)
In-Reply-To: <829eb784-76ce-7638-1380-4f718b059f92@wisemo.com>

On 10.10.20 00:54, Jakob Bohm wrote:

[...]

> Theoretically, locking on a raw file needs to be protocol-compatible
> with loop-mounting the same raw file, so if the loop driver doesn't
> probe those magic byte offsets to prevent out-of-order block writes,
> then there is little point for the qemu raw driver to do so.
> 
> This applies to both the loop driver in the host kernel and the loop
> driver on any other machine with file share access to the sane image
> file.

The file access locks aren’t meant to prevent arbitrary other programs
from accessing those specific few bytes, but to prevent concurrently
running qemu processes from accessing the image.  That’s why qemu
doesn’t lock the whole image file, but only a small and very specific
set of bytes.

The problem we originally faced was that some people would run qemu-img
to modify qcow2 images while a VM was running, leading to metadata
corruption and thus data loss.  This is the main reason the locks were
introduced.  However, the problem isn’t limited to qcow2 images.  Even
for raw images, we generally have to prevent e.g. concurrent writes to
the image (from other VMs that might want to use that image) because the
guest won’t be able to deal with that.  Hence why we take locks even on
non-qcow2 images.

> As for upgrading, I will try newer kernels packaged for the Debian
> version used, once the current large batch job has completed, but I
> doubt it will make much difference given the principles I just stated.

I’m not sure whether I understood your paragraphs above wrong, but I
don’t see how they explain why the bug would appear (i.e., why qemu
would fail taking the file lock).  It only seems to explain why it seems
superfluous for qemu to take locks when the loop driver will be the only
concurrent user of the image (presumably because the loop driver just
doesn’t take any locks; which means that qemu should be able to).

Max



  reply	other threads:[~2020-10-12  7:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2d9c8525-470f-a4e5-5d71-895046e2d782@wisemo.com>
2020-10-08 16:41 ` Which qemu change corresponds to RedHat bug 1655408 Philippe Mathieu-Daudé
2020-10-08 16:49   ` Jakob Bohm
2020-10-08 16:59     ` Philippe Mathieu-Daudé
2020-10-09  8:48     ` Max Reitz
2020-10-09 12:55       ` Jakob Bohm
2020-10-09 13:56         ` Max Reitz
2020-10-09 22:54           ` Jakob Bohm
2020-10-12  7:22             ` Max Reitz [this message]
2020-10-12 11:47         ` Max Reitz
2020-10-13  1:01           ` Jakob Bohm

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=a559a19b-f02d-214b-18b7-d7af5b06a251@redhat.com \
    --to=mreitz@redhat.com \
    --cc=jb-gnumlists@wisemo.com \
    --cc=jsnow@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-discuss@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).