From c95de7e2c40da4235ceda6d134ae069dae80157e Mon Sep 17 00:00:00 2001 From: Dong Xu Wang Date: Thu, 27 Oct 2011 17:22:28 +0800 Subject: block: fix qcow2_co_flush deadlock If qcow2_cache_flush failed, s->lock will not be unlock. Signed-off-by: Dong Xu Wang Signed-off-by: Kevin Wolf --- block/qcow2.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'block') 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); -- cgit v1.2.3