[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V7 4/6] qcow2: cancel the modification on fail i
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH V7 4/6] qcow2: cancel the modification on fail in qcow2_snapshot_create() |
Date: |
Fri, 20 Dec 2013 15:20:34 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Dec 05, 2013 at 08:02:50PM +0800, Wenchao Xia wrote:
> +restore_refcount:
> + if (qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size,
> -1)
> + < 0 && errp) {
> + /* Nothing can be done now, need image check later */
> + error_setg(&err, "%s\nqcow2: Error in restoring refcount in
> snapshot",
> + error_get_pretty(*errp));
> + error_free(*errp);
> + *errp = NULL;
> + error_propagate(errp, err);
> + }
We get here if writing the new snapshot list failed. If
qcow2_update_snapshot_refcount(..., -1) also fails I think we should
skip qcow2_free_clusters() below. We don't know the exact state of the
disk image anymore - better to leak clusters than to have a dangling
reference.
> +dealloc_cluster:
> + qcow2_free_clusters(bs, sn->l1_table_offset,
> + sn->l1_size * sizeof(uint64_t),
> + QCOW2_DISCARD_ALWAYS);
> +
> fail:
> g_free(sn->id_str);
> g_free(sn->name);
> --
> 1.7.1
>
>
- [Qemu-devel] [PATCH V7 0/6] qcow2: rollback the modification on fail in snapshot creation, Wenchao Xia, 2013/12/05
- [Qemu-devel] [PATCH V7 5/6] blkdebug: add debug events for snapshot, Wenchao Xia, 2013/12/05
- [Qemu-devel] [PATCH V7 6/6] qemu-iotests: add test for qcow2 snapshot, Wenchao Xia, 2013/12/05
- Re: [Qemu-devel] [PATCH V7 0/6] qcow2: rollback the modification on fail in snapshot creation, Wenchao Xia, 2013/12/08
- Re: [Qemu-devel] [PATCH V7 0/6] qcow2: rollback the modification on fail in snapshot creation, Wenchao Xia, 2013/12/12
- Re: [Qemu-devel] [PATCH V7 0/6] qcow2: rollback the modification on fail in snapshot creation, Wenchao Xia, 2013/12/17
- Re: [Qemu-devel] [PATCH V7 0/6] qcow2: rollback the modification on fail in snapshot creation, Stefan Hajnoczi, 2013/12/20