From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UP4kq-0003DO-Pq for qemu-devel@nongnu.org; Mon, 08 Apr 2013 01:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UP4kn-00038b-Iv for qemu-devel@nongnu.org; Mon, 08 Apr 2013 01:36:32 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:38295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UP4km-00037v-Qw for qemu-devel@nongnu.org; Mon, 08 Apr 2013 01:36:29 -0400 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Apr 2013 11:03:29 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 446833940057 for ; Mon, 8 Apr 2013 11:06:22 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r385aHa213959558 for ; Mon, 8 Apr 2013 11:06:17 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r385aGFv005221 for ; Mon, 8 Apr 2013 05:36:20 GMT From: Liu Ping Fan Date: Mon, 8 Apr 2013 13:36:06 +0800 Message-Id: <1365399368-26967-4-git-send-email-pingfank@linux.vnet.ibm.com> In-Reply-To: <1365399368-26967-1-git-send-email-pingfank@linux.vnet.ibm.com> References: <1365399368-26967-1-git-send-email-pingfank@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH v3 3/5] net: resolve race of tap backend and its peer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Stefan Hajnoczi , Anthony Liguori , mdroth When vhost net enabled, we should be sure that the user space fd handler is not in flight Signed-off-by: Liu Ping Fan --- net/tap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/net/tap.c b/net/tap.c index e19bb07..a3947eb 100644 --- a/net/tap.c +++ b/net/tap.c @@ -324,6 +324,11 @@ static void tap_poll(NetClientState *nc, bool enable) /* fixme, when tap backend on another thread, the disable should be sync */ tap_read_poll(s, enable); tap_write_poll(s, enable); + + if (!enable) { + /* need sync so vhost can take over polling */ + g_source_remove_poll(&nc->nsrc->source, &nc->nsrc->gfd); + } } int tap_get_fd(NetClientState *nc) -- 1.7.4.4