qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] block/preallocate: fix image truncation logic
@ 2024-10-09 13:58 Denis V. Lunev via
  2024-10-09 13:58 ` [PATCH 1/2] preallocate: do not allow to change BDS permission improperly Denis V. Lunev via
  2024-10-09 13:58 ` [PATCH 2/2] block/preallocate: fix image truncation logic Denis V. Lunev via
  0 siblings, 2 replies; 7+ messages in thread
From: Denis V. Lunev via @ 2024-10-09 13:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, Denis V . Lunev, Andrey Drobyshev,
	Vladimir Sementsov-Ogievskiy, Kevin Wolf

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.

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>


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH v2 0/2] block/preallocate: fix image truncation logic
@ 2024-10-09 15:37 Denis V. Lunev via
  2024-10-09 15:37 ` [PATCH 1/2] preallocate: do not allow to change BDS permission improperly Denis V. Lunev via
  0 siblings, 1 reply; 7+ messages in thread
From: Denis V. Lunev via @ 2024-10-09 15:37 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, Denis V . Lunev, Andrey Drobyshev,
	Vladimir Sementsov-Ogievskiy, Kevin Wolf

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>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-09 15:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 13:58 [PATCH 0/2] block/preallocate: fix image truncation logic Denis V. Lunev via
2024-10-09 13:58 ` [PATCH 1/2] preallocate: do not allow to change BDS permission improperly Denis V. Lunev via
2024-10-09 14:54   ` Andrey Drobyshev
2024-10-09 13:58 ` [PATCH 2/2] block/preallocate: fix image truncation logic Denis V. Lunev via
2024-10-09 14:54   ` Andrey Drobyshev
2024-10-09 14:54     ` Denis V. Lunev
  -- strict thread matches above, loose matches on Subject: below --
2024-10-09 15:37 [PATCH v2 0/2] " Denis V. Lunev via
2024-10-09 15:37 ` [PATCH 1/2] preallocate: do not allow to change BDS permission improperly Denis V. Lunev via

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).