cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
34b321
From e36a5a8613df42339773ebf48e07d063ad7484e8 Mon Sep 17 00:00:00 2001
34b321
From: Fam Zheng <famz@redhat.com>
34b321
Date: Mon, 5 Sep 2016 01:18:15 +0200
34b321
Subject: [PATCH] nbd-server: Set O_NONBLOCK on client fd
34b321
34b321
RH-Author: Fam Zheng <famz@redhat.com>
34b321
Message-id: <1473038295-7193-1-git-send-email-famz@redhat.com>
34b321
Patchwork-id: 72141
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH] nbd-server: Set O_NONBLOCK on client fd
34b321
Bugzilla: 1285453
34b321
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
34b321
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
34b321
RH-Acked-by: Max Reitz <mreitz@redhat.com>
34b321
34b321
Upstream: upstream uses IO channels that is not present in downstream.
34b321
Backporting that deserves a separate and deliberate justification BZ,
34b321
for 7.4.
34b321
34b321
Even with 2a68d80 (nbd-server: Coroutine based negotiation), QEMU still
34b321
hangs when client hangs, because recvmsg the socket fd is blocking. Set
34b321
the O_NONBLOCK to fix this.
34b321
34b321
Analyzed-by: Stefan Hajnoczi <stefanha@redhat.com>
34b321
Signed-off-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 nbd.c | 1 +
34b321
 1 file changed, 1 insertion(+)
34b321
34b321
diff --git a/nbd.c b/nbd.c
34b321
index c20e57e..8a32e18 100644
34b321
--- a/nbd.c
34b321
+++ b/nbd.c
34b321
@@ -1281,6 +1281,7 @@ static coroutine_fn void nbd_co_client_start(void *opaque)
34b321
     if (exp) {
34b321
         nbd_export_get(exp);
34b321
     }
34b321
+    qemu_set_nonblock(client->sock);
34b321
     if (nbd_negotiate(data)) {
34b321
         nbd_client_close(client);
34b321
         goto out;
34b321
-- 
34b321
1.8.3.1
34b321