From: Paolo Bonzini Date: Fri, 7 Apr 2023 15:32:58 +0000 (+0200) Subject: block: refresh bs->total_sectors on reopen X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=439cc330c58c6973a5c73dab36c334e29607d47b;p=qemu.git block: refresh bs->total_sectors on reopen After reopening a BlockDriverState, it's possible that the size of the underlying file has changed. This for example is covered by test 171. Right now, this is handled by the raw driver's has_variable_length = true setting. Since this will be removed by the next patch, handle it on reopen instead, together with the existing bdrv_refresh_limits. Signed-off-by: Paolo Bonzini Message-Id: <20230407153303.391121-4-pbonzini@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index 6a805ff0ea..be7dc5d3e9 100644 --- a/block.c +++ b/block.c @@ -4918,6 +4918,7 @@ static void bdrv_reopen_commit(BDRVReopenState *reopen_state) qdict_del(bs->options, "backing"); bdrv_refresh_limits(bs, NULL, NULL); + bdrv_refresh_total_sectors(bs, bs->total_sectors); } /*