From: Kevin Wolf <kwolf@redhat.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: qemu-block@nongnu.org, hreitz@redhat.com, den@openvz.org,
stefanha@redhat.com, qemu-stable@nongnu.org,
qemu-devel@nongnu.org
Subject: Re: [PATCH 3/4] qcow2: Fix corruption on discard during write with COW
Date: Tue, 12 May 2026 14:22:49 +0200 [thread overview]
Message-ID: <agMbmZvW3MCSX3BF@redhat.com> (raw)
In-Reply-To: <76eb4371-8cfe-4d9f-870f-56c9a6dda334@proxmox.com>
Am 29.04.2026 um 17:28 hat Fiona Ebner geschrieben:
> Am 27.04.26 um 7:04 PM schrieb Kevin Wolf:
> > @@ -2000,6 +2028,15 @@ int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset,
> > int64_t cleared;
> > int ret;
> >
> > + /*
> > + * If we're touching a cluster for which allocating writes are in flight,
> > + * wait for them to complete to avoid conflicting metadata updates.
> > + *
> > + * We don't need to allocate a QCowL2Meta for the discard operation because
> > + * s->lock is held for the duration of the whole operation.
>
> The caller in qcow2_make_empty() does not acquire s->lock AFAICS. Can
> that be a problem?
This is the case the comment inside wait_for_dependencies() is about:
/*
* Discard has some non-coroutine callers (creating internal snapshots and
* make empty). They are calling from qemu-img or in a drained section, so
* we know that no writes can be in progress.
*/
So it should be fine in practice because we know a bigger hammer is
already in use for synchronisation.
Kevin
> > + */
> > + wait_for_dependencies(bs, offset, bytes);
> > +
> > /* Caller must pass aligned values, except at image end */
> > assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
> > assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||
next prev parent reply other threads:[~2026-05-12 12:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 17:05 [PATCH 0/4] qcow2: Fix corruption on discard during write with COW Kevin Wolf
2026-04-27 17:05 ` [PATCH 1/4] commit: Drain nodes across all of bdrv_commit() Kevin Wolf
2026-04-29 15:06 ` Fiona Ebner
2026-05-12 12:16 ` Kevin Wolf
2026-05-13 15:28 ` Fiona Ebner
2026-04-27 17:05 ` [PATCH 2/4] qemu-io: Add 'aio_discard' command Kevin Wolf
2026-04-28 10:59 ` Denis V. Lunev
2026-04-27 17:05 ` [PATCH 3/4] qcow2: Fix corruption on discard during write with COW Kevin Wolf
2026-04-29 15:28 ` Fiona Ebner
2026-05-12 12:22 ` Kevin Wolf [this message]
2026-05-13 15:34 ` Fiona Ebner
2026-05-21 12:12 ` Fiona Ebner
2026-05-21 13:46 ` Kevin Wolf
2026-05-21 14:18 ` Fiona Ebner
2026-05-21 14:35 ` Kevin Wolf
2026-05-21 15:14 ` Fiona Ebner
2026-05-21 16:14 ` Thomas Lamprecht
2026-04-27 17:05 ` [PATCH 4/4] iotests/046: Test that discard/write_zeroes wait for dependencies Kevin Wolf
2026-04-28 11:00 ` [PATCH 0/4] qcow2: Fix corruption on discard during write with COW Denis V. Lunev
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=agMbmZvW3MCSX3BF@redhat.com \
--to=kwolf@redhat.com \
--cc=den@openvz.org \
--cc=f.ebner@proxmox.com \
--cc=hreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@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 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.