From: Maxim Levitsky <mlevitsk@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
vsementsov@virtuozzo.com, Alberto Garcia <berto@igalia.com>,
qemu-block@nongnu.org, zhang_youjia@126.com,
Max Reitz <mreitz@redhat.com>,
andrey.shinkevich@virtuozzo.com,
Maxim Levitsky <mlevitsk@redhat.com>
Subject: [PATCH 0/1] Fix qcow2 corruption after addition of subcluster support
Date: Mon, 23 Nov 2020 17:49:28 +0200 [thread overview]
Message-ID: <20201123154929.330338-1-mlevitsk@redhat.com> (raw)
On this weekend, I had discovered that one of my VMs started to act weird.
Due to this, I found out that it and most of the other VMs I have,
have grown an qcow2 corruption.
So after some bisecting, digging through dumps, and debugging,
I think I found the root cause and a fix.
In addition to that I would like to raise few points:
1. I had to use qcow2-dump from (*)
(it is also on github but without source. wierd...)
to examine the L1/L2 tables and refcount tables.
It seems that there were few attempts (**), (***) to make an official tool that
would dump at least L1/L2/refcount tables, but nothing got accepted
so far.
I think that an official tool to dump at least basic qcow2 structure
would be very helpful to discover/debug qcow2 corruptions.
I had to study again the qcow2 format for this, so I can help with that.
2. 'qemu-img check -r all' is happy to create clusters that are referenced
from multiple L2 entries.
This isn't technically wrong, since write through any of these l2 entries
will COW the cluster.
However I would be happy to know that my images don't have such clusters,
so I would like qemu-img check to at least notify about this.
Can we add some -check-weird-but-legal flag to it to check this?
Few notes about the condition for this corruption to occur:
I have a bunch of VMs which are running each using two qcow2 files,
base and a snapshot on top of it, which I 'qemu-img commit' once in a while.
Discard is enabled to avoid wasting disk space.
Since discard is enabled, 'qemu-img commit' often discards data on the base disk.
The corruption happens after such a commit, and manifests in a stale L2
entry that was supposed to be discarded but now points to an unused cluster.
I wasn't able to reproduce this on small test case so far.
Best regards,
Maxim Levitsky
(*)https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg02760.html
(**) https://patchwork.kernel.org/project/qemu-devel/patch/20180328133845.20632-1-berto@igalia.com/
(***) https://patchwork.kernel.org/project/qemu-devel/cover/1578990137-308222-1-git-send-email-andrey.shinkevich@virtuozzo.com/
Maxim Levitsky (1):
Fix qcow2 corruption on discard
block/qcow2-cluster.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.26.2
next reply other threads:[~2020-11-23 15:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 15:49 Maxim Levitsky [this message]
2020-11-23 15:49 ` [PATCH 1/1] Fix qcow2 corruption on discard Maxim Levitsky
2020-11-23 16:09 ` Kevin Wolf
2020-11-23 18:20 ` Alberto Garcia
2020-11-23 18:23 ` Maxim Levitsky
2020-11-23 17:38 ` Kevin Wolf
2020-11-23 18:11 ` Maxim Levitsky
2020-11-24 9:17 ` Kevin Wolf
2020-11-24 18:59 ` Alberto Garcia
2020-11-24 18:59 ` Maxim Levitsky
2020-11-24 19:44 ` Maxim Levitsky
2020-11-25 16:49 ` Alberto Garcia
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=20201123154929.330338-1-mlevitsk@redhat.com \
--to=mlevitsk@redhat.com \
--cc=andrey.shinkevich@virtuozzo.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
--cc=zhang_youjia@126.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 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.