block: fix preallocate filter: don't do unaligned preallocate requests
commit45e62b464a5fa62f0f005b76f59ad587944cd55f
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tue, 15 Feb 2022 12:16:09 +0000 (15 13:16 +0100)
committerHanna Reitz <hreitz@redhat.com>
Mon, 7 Mar 2022 08:19:20 +0000 (7 09:19 +0100)
tree6d36c058260d83f60888847b76cd19d017639b0e
parentb0ea6c98fa2431b9e24b3a53b8b42c960ccf3dba
block: fix preallocate filter: don't do unaligned preallocate requests

There is a bug in handling BDRV_REQ_NO_WAIT flag: we still may wait in
wait_serialising_requests() if request is unaligned. And this is
possible for the only user of this flag (preallocate filter) if
underlying file is unaligned to its request_alignment on start.

So, we have to fix preallocate filter to do only aligned preallocate
requests.

Next, we should fix generic block/io.c somehow. Keeping in mind that
preallocate is the only user of BDRV_REQ_NO_WAIT and that we have to
fix its behavior now, it seems more safe to just assert that we never
use BDRV_REQ_NO_WAIT with unaligned requests and add corresponding
comment. Let's do so.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Message-Id: <20220215121609.38570-1-vsementsov@virtuozzo.com>
[hreitz: Rebased on block GS/IO split]
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
block/io.c
block/preallocate.c
include/block/block-common.h