yeahuh / rpms / qemu-kvm

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