OSDN Git Service

qcow2: Rework qcow2_snapshot_create error handling
authorKevin Wolf <kwolf@redhat.com>
Wed, 16 Nov 2011 11:43:59 +0000 (12:43 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 5 Dec 2011 13:51:36 +0000 (14:51 +0100)
commitd1ea98d56dc2485b4637a1ca19feef786b3aee8f
treee2f7b247199b3f261b696af7e3f55ae34cca8044
parent03343166f703d5c8f02b8519f8493c56e5541ae7
qcow2: Rework qcow2_snapshot_create error handling

Increase refcounts only after allocating a new L1 table has succeeded in
order to make leaks less likely. If writing the snapshot table fails,
revert in-memory state to be consistent with that on disk.

While at it, make it return the real error codes instead of -1.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
block/qcow2-snapshot.c