[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH for-4.2 11/13] qcow2: Fix v3 snapshot table entr
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [PATCH for-4.2 11/13] qcow2: Fix v3 snapshot table entry compliancy |
Date: |
Tue, 30 Jul 2019 14:12:39 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 7/30/19 12:25 PM, Max Reitz wrote:
> qcow2 v3 images require every snapshot table entry to have at least 16
> bytes of extra data. If they do not, let qemu-img check -r all fix it.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/qcow2-snapshot.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
> index 9e8c7c1f7f..e22c964b2a 100644
> --- a/block/qcow2-snapshot.c
> +++ b/block/qcow2-snapshot.c
> @@ -502,6 +502,21 @@ int coroutine_fn
> qcow2_check_read_snapshot_table(BlockDriverState *bs,
> result->corruptions -= nb_clusters_reduced;
> }
>
> + /*
> + * All of v3 images' snapshot table entries need to have at least
> + * 16 bytes of extra data.
> + */
> + if (s->qcow_version >= 3) {
> + int i;
> + for (i = 0; i < s->nb_snapshots; i++) {
> + if (s->snapshots[i].extra_data_size < 16) {
s/16/sizeof(extra)/ may be nicer here.
> + result->corruptions++;
> + fprintf(stderr, "%s snapshot table entry %i is incomplete\n",
> + fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i);
> + }
> + }
> + }
> +
> return 0;
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH for-4.2 08/13] qcow2: Fix broken snapshot table entries, (continued)
- [Qemu-block] [PATCH for-4.2 08/13] qcow2: Fix broken snapshot table entries, Max Reitz, 2019/07/30
- [Qemu-block] [PATCH for-4.2 09/13] qcow2: Fix overly long snapshot tables, Max Reitz, 2019/07/30
- [Qemu-block] [PATCH for-4.2 10/13] qcow2: Repair snapshot table with too many entries, Max Reitz, 2019/07/30
- [Qemu-block] [PATCH for-4.2 11/13] qcow2: Fix v3 snapshot table entry compliancy, Max Reitz, 2019/07/30
- Re: [Qemu-block] [PATCH for-4.2 11/13] qcow2: Fix v3 snapshot table entry compliancy,
Eric Blake <=
- [Qemu-block] [PATCH for-4.2 12/13] iotests: Add peek_file* functions, Max Reitz, 2019/07/30
- [Qemu-block] [PATCH for-4.2 13/13] iotests: Test qcow2's snapshot table handling, Max Reitz, 2019/07/30
- Re: [Qemu-block] [PATCH for-4.2 00/13] qcow2: Let check -r all repair some snapshot bits, Eric Blake, 2019/07/30