aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorDong Xu Wang <wdongxu@linux.vnet.ibm.com>2011-10-27 17:22:28 +0800
committerKevin Wolf <kwolf@redhat.com>2011-10-28 19:25:49 +0200
commitc95de7e2c40da4235ceda6d134ae069dae80157e (patch)
tree1fbfe22e65c8fa56d29b630092f2b4202a00c0e3 /block
parent08ae330e1754bf03df1388065ea508dc089ab3fd (diff)
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>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index a181932b67..ef057d31e0 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1113,11 +1113,13 @@ static int qcow2_co_flush(BlockDriverState *bs)
qemu_co_mutex_lock(&s->lock);
ret = qcow2_cache_flush(bs, s->l2_table_cache);
if (ret < 0) {
+ qemu_co_mutex_unlock(&s->lock);
return ret;
}
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
if (ret < 0) {
+ qemu_co_mutex_unlock(&s->lock);
return ret;
}
qemu_co_mutex_unlock(&s->lock);