mirror of https://github.com/xemu-project/xemu.git
block: fix qcow2_co_flush deadlock
If qcow2_cache_flush failed, s->lock will not be unlock. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
08ae330e17
commit
c95de7e2c4
|
@ -1113,11 +1113,13 @@ static int qcow2_co_flush(BlockDriverState *bs)
|
||||||
qemu_co_mutex_lock(&s->lock);
|
qemu_co_mutex_lock(&s->lock);
|
||||||
ret = qcow2_cache_flush(bs, s->l2_table_cache);
|
ret = qcow2_cache_flush(bs, s->l2_table_cache);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
qemu_co_mutex_unlock(&s->lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
|
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
qemu_co_mutex_unlock(&s->lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
qemu_co_mutex_unlock(&s->lock);
|
qemu_co_mutex_unlock(&s->lock);
|
||||||
|
|
Loading…
Reference in New Issue