Skip to contentSkip to conversation

block:avoid deadlock in sheepdog.c

PATCH Applied Dong Xu Wang 2 participants 2 messages Nov 22, 2011 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block:avoid deadlock in sheepdog.c

From: Dong Xu Wang <[email protected]>

s->lock should be unlocked before leaving add_aio_request.

---
 block/sheepdog.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
block/sheepdog.c +2 -0
index 9f80609..62f1f3a 100644
@@ -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;
         }
Signature · 1 line
1.7.5.4
Applied
#1 lore raw

Am 22.11.2011 03:56, schrieb Dong Xu Wang:

Quoted 5 lines

From: Dong Xu Wang <[email protected]>

s->lock should be unlocked before leaving add_aio_request.

Thanks, applied to the block-stable branch (for 1.0). But please keep Kazutaka CCed for future Sheepdog patches.

Kevin

Quoted 24 lines
---
 block/sheepdog.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
block/sheepdog.c +2 -0
index 9f80609..62f1f3a 100644
@@ -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;
         }