qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH] nbd-client: fix hang after server


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH] nbd-client: fix hang after server closes connection
Date: Tue, 22 Aug 2017 10:49:28 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 08/21/2017 01:15 PM, Stefan Hajnoczi wrote:
Commit 72b6ffc76653214b69a94a7b1643ff80df134486 ("nbd-client: Fix
regression when server sends garbage") improved NBD client behavior when
the connection enters a broken state.

The following still does not behave as expected:

   $ qemu-nbd -p 1234 -x drive0 -f qcow2 test.qcow2
   $ qemu-system-x86_64 -M accel=kvm -m 1G \
         -drive if=virtio,id=drive0,file=nbd://localhost:1234/drive0,format=raw
   $ pkill qemu-nbd
   (qemu) quit
   ...hang...

QEMU should be able to quit even when the connection was previously
closed by the NBD server.  Currently the nbd_read_reply_entry()
coroutine terminates without letting in-flight requests know that the
connection is dead.

This patch flags the connection as dead so in-flight requests can
complete.

Reported-by: Longxiang Lyu <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>

Acked-by: Philippe Mathieu-Daudé <address@hidden>

---
  block/nbd-client.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/nbd-client.c b/block/nbd-client.c
index 422ecb4307..5a5fe02015 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -80,6 +80,7 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)
              error_report_err(local_err);
          }
          if (ret <= 0) {
+            s->quit = true;
              break;
          }
@@ -107,9 +108,6 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)
          qemu_coroutine_yield();
      }
- if (ret < 0) {
-        s->quit = true;
-    }
      nbd_recv_coroutines_enter_all(s);
      s->read_reply_co = NULL;
  }




reply via email to

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