Fix: remove bogus QDECREF()
PATCH 1/1 Fix: remove bogus QDECREF()
This extra QDECREF() was causing quorum_close() to crash while doing bdrv_unref().
As the optional options qdict should belong to the block layer so do not use QDECREF() on it.
I tested the following inti and qemu exit sequences.
tested regular snapshots on device=virtio0 ok tested command line quorum ok
tested command line quorum + snapshot transaction ok tested quorum open by reference ok
tested quorum open by reference + snapshot transaction ok tested quorum open at once ok
tested quorum open at once + snapshot transaction ok
Benoît Canet (1):
blockdev: Fix wrong usage of QDECREF causing snapshoted quorum to
crash on close.
blockdev.c | 2 -- 1 file changed, 2 deletions(-)
Signature · 1 line
1.8.3.2
PATCH 1/1 blockdev: Fix wrong usage of QDECREF causing snapshoted quorum to crash on close.
As bdrv_open() documentation states:
"The reference to the QDict belongs to the block layer
* after the call (even on failure), so if the caller intends to reuse the
* dictionary, it needs to use QINCREF() before calling bdrv_open."
the optional options dict will not be reused after bdrv_open() and should belong to the block layer so remove the extra QDECREF(options).
--- blockdev.c | 2 -- 1 file changed, 2 deletions(-)
blockdev.c +0 -2
@@ -1316,8 +1316,6 @@ static void external_snapshot_prepare(BlkTransactionState *common,if (ret !=0 ) {error_propagate (errp, local_err); } - -QDECREF (options); }static void external_snapshot_commit (BlkTransactionState *common)
Signature · 1 line
1.8.3.2
Re: [Qemu-devel] [PATCH] blockdev: Fix wrong usage of QDECREF causing snapshoted quorum to crash on close.
Am 13.02.2014 um 17:22 hat Benoît Canet geschrieben:
Quoted 9 lines
As
bdrv_open()documentation states:
"The reference to the QDict belongs to the block layer
* after the call (even on failure), so if the caller intends to reuse the
* dictionary, it needs to useQINCREF()before callingbdrv_open."the optional options dict will not be reused after
bdrv_open()and should belong to the block layer so remove the extra QDECREF(options).Signed-off-by Benoit Canet <[email protected]>
Ouch, yes. Sorry for not catching this in the review.
Stefan Hajnoczi
AppliedRe: [Qemu-devel] [PATCH] blockdev: Fix wrong usage of QDECREF causing snapshoted quorum to crash on close.
In reply to Benoît CanetQuoted 5 lines · Benoît Canet
As
bdrv_open()documentation states:
"The reference to the QDict belongs to the block layer
* after the call (even on failure), so if the caller intends to reuse the
* dictionary, it needs to useQINCREF()before callingbdrv_open."
Quoted 7 lines
the optional options dict will not be reused after
bdrv_open()and should belong to the block layer so remove the extra QDECREF(options).Signed-off-by Benoit Canet <[email protected]>--- blockdev.c | 2 -- 1 file changed, 2 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan