qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/12] sheepdog: Avoid deadlock in error path


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 05/12] sheepdog: Avoid deadlock in error path
Date: Fri, 25 Nov 2011 19:12:08 +0100

From: Dong Xu Wang <address@hidden>

s->lock should be unlocked before leaving add_aio_request.

Signed-off-by: Dong Xu Wang <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 block/sheepdog.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 9f80609..62f1f3a 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;
         }
-- 
1.7.6.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]