From: "Denis V. Lunev" via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Denis V . Lunev" <den@openvz.org>,
Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
Kevin Wolf <kwolf@redhat.com>
Subject: [PATCH v2 0/2] block/preallocate: fix image truncation logic
Date: Wed, 9 Oct 2024 18:37:35 +0300 [thread overview]
Message-ID: <20241009153924.158721-1-den@openvz.org> (raw)
Recent QEMU changes around preallocate_set_perm mandates that it is not
possible to poll on aio_context inside this function anymore. Thus
truncate operation has been moved inside bottom half. This bottom half
is scheduled from preallocate_set_perm() and that is all.
This approach proven to be problematic in a lot of places once
additional operations are executed over preallocate filter in
production. The code validates that permissions have been really changed
just after the call to the set operation.
All permissions operations or block driver graph changes are performed
inside the quiscent state in terms of the block layer. This means that
there are no in-flight packets which is guaranteed by the passing
through bdrv_drain() section.
The idea is that we should effectively disable preallocate filter inside
bdrv_drain() and unblock permission changes. This section is definitely
not on the hot path and additional single truncate operation will not
hurt.
Unfortunately bdrv_drain_begin() callback according to the documentation
also disallow waiting inside. Thus original approach with the bottom
half is not changed. bdrv_drain_begin() schedules the operation and in
order to ensure that it has been really executed before completion of
the section increments the amount of in-flight requests.
In addition to this we should disable lifting WRITE permission when
truncate() operation is not fully completed yet.
Changes from v1:
- rebased to the latest master
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
CC: Kevin Wolf <kwolf@redhat.com>
next reply other threads:[~2024-10-09 15:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 15:37 Denis V. Lunev via [this message]
2024-10-09 15:37 ` [PATCH 1/2] preallocate: do not allow to change BDS permission improperly Denis V. Lunev via
2024-10-09 15:37 ` [PATCH 2/2] block/preallocate: fix image truncation logic Denis V. Lunev via
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=20241009153924.158721-1-den@openvz.org \
--to=qemu-devel@nongnu.org \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/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).