[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extenda
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable |
Date: |
Wed, 3 Apr 2013 11:22:15 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 03.04.2013 um 11:02 hat Wenchao Xia geschrieben:
> >
> >No, if bdrv_snapshot_delete() can fail, you need to split it in two
> >parts: one that can fail, and one that cannot. If you cannot, then
> >there are two possibilities:
> >
> >- if the failures are minor and could be repaired with "qemu-img check -r"
> >(e.g. lost clusters), then this is not optimal but can still be done;
> >
> >- otherwise, the operation simply cannot be made transactionable.
> >
> >In the case of qcow2_snapshot_delete, everything except
> >
> > ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, nb_snapshots),
> > &header_data, sizeof(header_data));
> > if (ret < 0) {
> > goto fail;
> > }
> >
> >must be in the prepare phase. Everything after "fail" (which right now
> >is nothing, but it should at least undo the qcow2_alloc_clusters operation)
> >must be in the rollback phase. Everything in the middle is the commit
> >phase.
> >
> >Paolo
> >
> Sorry I haven't state it clearly. What about bdrv_snapshot_create()
> operation? If it need to be rolled back, I think bdrv_snapshot_delete()
> will get called and it may fail.
This means that you're doing it wrong. Instead of deleting the snapshot
on rollback, you shouldn't complete the creation until commit.
If the one bdrv_pwrite_sync() in the commit stage fails, we cannot
maintain transactional semantics. I guess its unlikely enough.
> But in most case if
> bdrv_snapshot_create() succeed before, the bdrv_snapshot_delete should
> succeed also, so if fail there may be unexpected error below, could
> assert be used for this?
assert() is only for programming errors, not for things like hardware
failure.
Kevin
- [Qemu-devel] [PATCH 0/3] block: make qmp_transaction extendable, Wenchao Xia, 2013/04/01
- [Qemu-devel] [PATCH 1/3] block: add function deappend(), Wenchao Xia, 2013/04/01
- [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Wenchao Xia, 2013/04/01
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Kevin Wolf, 2013/04/02
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Wenchao Xia, 2013/04/03
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Paolo Bonzini, 2013/04/03
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Wenchao Xia, 2013/04/03
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Paolo Bonzini, 2013/04/03
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable,
Kevin Wolf <=
- Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Wenchao Xia, 2013/04/03
Re: [Qemu-devel] [PATCH 2/3] block: adjust qmp_transaction to be extendable, Stefan Hajnoczi, 2013/04/17
[Qemu-devel] [PATCH 3/3] block: change rollback sequence in qmp_transaction, Wenchao Xia, 2013/04/01