diff mbox series

[v4,08/21] parallels: Recreate used bitmap in parallels_check_leak()

Message ID 20231228101232.372142-9-alexander.ivanov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series parallels: Add full dirty bitmap support | expand

Commit Message

Alexander Ivanov Dec. 28, 2023, 10:12 a.m. UTC
In parallels_check_leak() file can be truncated. In this case the used
bitmap would not comply to the file. Recreate the bitmap after file
truncation.

Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
 block/parallels.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Denis V. Lunev Jan. 16, 2024, 2:24 p.m. UTC | #1
On 12/28/23 11:12, Alexander Ivanov wrote:
> In parallels_check_leak() file can be truncated. In this case the used
> bitmap would not comply to the file. Recreate the bitmap after file
> truncation.
>
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
> ---
>   block/parallels.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/block/parallels.c b/block/parallels.c
> index 8a6e2ba7ee..04c114f696 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -807,6 +807,14 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
>                   return ret;
>               }
>               s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS;
> +
> +            parallels_free_used_bitmap(bs);
> +            ret = parallels_fill_used_bitmap(bs);
> +            if (ret == -ENOMEM) {
> +                res->check_errors++;
> +                return ret;
> +            }
> +
>               if (explicit) {
>                   res->leaks_fixed += count;
>               }
Reviewed-by: Denis V. Lunev <den@openvz.org>
diff mbox series

Patch

diff --git a/block/parallels.c b/block/parallels.c
index 8a6e2ba7ee..04c114f696 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -807,6 +807,14 @@  parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
                 return ret;
             }
             s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS;
+
+            parallels_free_used_bitmap(bs);
+            ret = parallels_fill_used_bitmap(bs);
+            if (ret == -ENOMEM) {
+                res->check_errors++;
+                return ret;
+            }
+
             if (explicit) {
                 res->leaks_fixed += count;
             }