Received: from eggs.gnu.org ([2001:4830:134:3::10]:42590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aViaV-00036Z-30 for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:34:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aViaT-000769-Uw for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:34:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48262) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aViaT-00075z-Ea for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:34:53 -0500 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 (Postfix) with ESMTPS id 1EB8E804EC for ; Tue, 16 Feb 2016 16:34:53 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1GGYlLY023440 for ; Tue, 16 Feb 2016 11:34:52 -0500 From: Paolo Bonzini Date: Tue, 16 Feb 2016 17:34:21 +0100 Message-Id: <1455640486-6101-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1455640486-6101-1-git-send-email-pbonzini@redhat.com> References: <1455640486-6101-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 03/28] Revert "qemu-char: Keep pty slave file descriptor open until the master is closed" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This reverts commit 34689e206abddac87a5217d458534e24f2a05562. Marc-Andr=C3=A9 Lureau provided the following commentary: "It looks like = if a the slave is opened, then Linux will buffer the master writes, up to a few kb and then throttle, so it's not entirely blocked but eventually the guest VM dies. However, not having any slave open it will simply let the write go and discard the data. At least, virt-install configures a pty for the serial but viewers like virt-manager do not necessarily open it. And, if there are no viewers, it will just hang. If qemu starts reading all the data from the slave, I don't think interactions with other slaves will work. I don't see much options but to close the slave, thus reverting this patch." Signed-off-by: Paolo Bonzini --- qemu-char.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 1b7d5da..00caf65 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1171,7 +1171,6 @@ typedef struct { int connected; guint timer_tag; guint open_tag; - int slave_fd; } PtyCharDriver; =20 static void pty_chr_update_read_handler_locked(CharDriverState *chr); @@ -1348,7 +1347,6 @@ static void pty_chr_close(struct CharDriverState *c= hr) =20 qemu_mutex_lock(&chr->chr_write_lock); pty_chr_state(chr, 0); - close(s->slave_fd); object_unref(OBJECT(s->ioc)); if (s->timer_tag) { g_source_remove(s->timer_tag); @@ -1376,6 +1374,7 @@ static CharDriverState *qemu_chr_open_pty(const cha= r *id, return NULL; } =20 + close(slave_fd); qemu_set_nonblock(master_fd); =20 chr =3D qemu_chr_alloc(common, errp); @@ -1400,7 +1399,6 @@ static CharDriverState *qemu_chr_open_pty(const cha= r *id, chr->explicit_be_open =3D true; =20 s->ioc =3D QIO_CHANNEL(qio_channel_file_new_fd(master_fd)); - s->slave_fd =3D slave_fd; s->timer_tag =3D 0; =20 return chr; --=20 2.5.0