summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorDong Xu Wang <wdongxu@linux.vnet.ibm.com>2011-11-22 10:56:58 +0800
committerKevin Wolf <kwolf@redhat.com>2011-11-22 10:33:43 +0100
commite12719b655f078fe607556f81e8a90275db40e62 (patch)
tree6eb90c13d916bd70d058c878dc2b9ee8700e8c2c /block
parent783fbaccd6580fd5118be4e9437ed40410068d7e (diff)
downloadqemu-e12719b655f078fe607556f81e8a90275db40e62.tar.gz
qemu-e12719b655f078fe607556f81e8a90275db40e62.tar.bz2
qemu-e12719b655f078fe607556f81e8a90275db40e62.zip
sheepdog: Avoid deadlock in error path
s->lock should be unlocked before leaving add_aio_request. 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/sheepdog.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 9f8060960f..62f1f3a0cf 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1116,6 +1116,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
/* send a header */
ret = do_write(s->fd, &hdr, sizeof(hdr));
if (ret) {
+ qemu_co_mutex_unlock(&s->lock);
error_report("failed to send a req, %s", strerror(errno));
return -EIO;
}
@@ -1123,6 +1124,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
if (wlen) {
ret = do_writev(s->fd, iov, wlen, aio_req->iov_offset);
if (ret) {
+ qemu_co_mutex_unlock(&s->lock);
error_report("failed to send a data, %s", strerror(errno));
return -EIO;
}