From owner-svn-src-head@FreeBSD.ORG Mon Nov 3 22:17:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60BD94D7; Mon, 3 Nov 2014 22:17:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C89A26C; Mon, 3 Nov 2014 22:17:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA3MHQvs056710; Mon, 3 Nov 2014 22:17:26 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA3MHQSj056709; Mon, 3 Nov 2014 22:17:26 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201411032217.sA3MHQSj056709@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 3 Nov 2014 22:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274063 - head/sys/dev/virtio/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2014 22:17:26 -0000 Author: bryanv Date: Mon Nov 3 22:17:25 2014 New Revision: 274063 URL: https://svnweb.freebsd.org/changeset/base/274063 Log: Create the tty device after the port is completely initialized This fixes a race with a tty open before the host is the ready. MFC after: 1 month Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c ============================================================================== --- head/sys/dev/virtio/console/virtio_console.c Mon Nov 3 21:26:11 2014 (r274062) +++ head/sys/dev/virtio/console/virtio_console.c Mon Nov 3 22:17:25 2014 (r274063) @@ -1048,17 +1048,17 @@ vtcon_port_create(struct vtcon_softc *sc return (error); } - tty_makedev(port->vtcport_tty, NULL, "%s%r.%r", VTCON_TTY_PREFIX, - device_get_unit(dev), id); - VTCON_LOCK(sc); VTCON_PORT_LOCK(port); - vtcon_port_enable_intr(port); scport->vcsp_port = port; + vtcon_port_enable_intr(port); vtcon_port_submit_event(port, VIRTIO_CONSOLE_PORT_READY, 1); VTCON_PORT_UNLOCK(port); VTCON_UNLOCK(sc); + tty_makedev(port->vtcport_tty, NULL, "%s%r.%r", VTCON_TTY_PREFIX, + device_get_unit(dev), id); + return (0); }