From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAelm-0005uo-Le for qemu-devel@nongnu.org; Fri, 25 Jul 2014 08:38:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAelb-0001UQ-BX for qemu-devel@nongnu.org; Fri, 25 Jul 2014 08:38:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAelb-0001UL-4O for qemu-devel@nongnu.org; Fri, 25 Jul 2014 08:38:31 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6PCcUs8011345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 25 Jul 2014 08:38:30 -0400 Received: from playground.com (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6PCcQ7Q020895 for ; Fri, 25 Jul 2014 08:38:29 -0400 From: Paolo Bonzini Date: Fri, 25 Jul 2014 14:38:24 +0200 Message-Id: <1406291904-14071-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1406291904-14071-1-git-send-email-pbonzini@redhat.com> References: <1406291904-14071-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL v2 1/1] qemu-char: ignore flow control if a PTY's slave is not connected List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org After commit f702e62 (serial: change retry logic to avoid concurrency, 2014-07-11), guest boot hangs if the backend is an unconnected PTY. The reason is that PTYs do not support G_IO_HUP, and serial_xmit is never called. To fix this, simply invoke serial_xmit immediately (via g_idle_source_new) when this happens. Tested-by: Pavel Hrdina Signed-off-by: Paolo Bonzini --- qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index 7acc03f..956be49 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1168,6 +1168,9 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len) static GSource *pty_chr_add_watch(CharDriverState *chr, GIOCondition cond) { PtyCharDriver *s = chr->opaque; + if (!s->connected) { + return NULL; + } return g_io_create_watch(s->fd, cond); } @@ -3664,6 +3667,10 @@ int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, } src = s->chr_add_watch(s, cond); + if (!src) { + return -EINVAL; + } + g_source_set_callback(src, (GSourceFunc)func, user_data, NULL); tag = g_source_attach(src, NULL); g_source_unref(src); -- 1.8.3.1