diff mbox

sheepdog: fix co_recv coroutine context

Message ID 1327943406-26444-1-git-send-email-morita.kazutaka@lab.ntt.co.jp
State New
Headers show

Commit Message

MORITA Kazutaka Jan. 30, 2012, 5:10 p.m. UTC
The co_recv coroutine has two things that will try to enter it:

  1. The select(2) read callback on the sheepdog socket.
  2. The aio_add_request() blocking operations, including a coroutine
     mutex.

This patch fixes it by setting NULL to co_recv before sending data.

In future, we should make the sheepdog driver fully coroutine-based
and simplify request handling.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
---
 block/sheepdog.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Kevin Wolf Feb. 9, 2012, 2:48 p.m. UTC | #1
Am 30.01.2012 18:10, schrieb MORITA Kazutaka:
> The co_recv coroutine has two things that will try to enter it:
> 
>   1. The select(2) read callback on the sheepdog socket.
>   2. The aio_add_request() blocking operations, including a coroutine
>      mutex.
> 
> This patch fixes it by setting NULL to co_recv before sending data.
> 
> In future, we should make the sheepdog driver fully coroutine-based
> and simplify request handling.
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 9416400..00276f6f 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -629,6 +629,9 @@  static void coroutine_fn aio_read_response(void *opaque)
 
     switch (acb->aiocb_type) {
     case AIOCB_WRITE_UDATA:
+        /* this coroutine context is no longer suitable for co_recv
+         * because we may send data to update vdi objects */
+        s->co_recv = NULL;
         if (!is_data_obj(aio_req->oid)) {
             break;
         }