qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC PATCH v4 04/15] net: resolve race of tap backend and i


From: Liu Ping Fan
Subject: [Qemu-devel] [RFC PATCH v4 04/15] net: resolve race of tap backend and its peer
Date: Wed, 17 Apr 2013 16:39:13 +0800

From: Liu Ping Fan <address@hidden>

When vhost net enabled, we should be sure that the user space
fd handler is not in flight

Signed-off-by: Liu Ping Fan <address@hidden>
---
 net/tap.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/tap.c b/net/tap.c
index 35cbb6e..b5629e3 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -41,6 +41,7 @@
 #include "qemu/error-report.h"
 
 #include "net/tap.h"
+#include "util/event_gsource.h"
 
 #include "hw/vhost_net.h"
 
@@ -327,6 +328,10 @@ static void tap_poll(NetClientState *nc, bool enable)
     tap_read_poll(s, enable);
     tap_write_poll(s, enable);
 
+    if (!enable) {
+        /* need sync so vhost can take over polling */
+        g_source_remove_poll(&s->nsrc->source, &s->nsrc->gfd);
+    }
 }
 
 int tap_get_fd(NetClientState *nc)
-- 
1.7.4.4




reply via email to

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