From nobody Wed Dec 29 20:41:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DD2061924B0D; Wed, 29 Dec 2021 20:41:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JPNbp6pJpz584q; Wed, 29 Dec 2021 20:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B82F38AB; Wed, 29 Dec 2021 20:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BTKfQqT099572; Wed, 29 Dec 2021 20:41:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BTKfQZI099571; Wed, 29 Dec 2021 20:41:26 GMT (envelope-from git) Date: Wed, 29 Dec 2021 20:41:26 GMT Message-Id: <202112292041.1BTKfQZI099571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 33812d60b960 - main - vfs_mountroot: Check for root dev before waiting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33812d60b9601d7ef8a7222c063696bfd6a77f41 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640810487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yTyA8H4CBRMbPriL7vIOLcRe/hNWKinYMbfT6lwXEqc=; b=WmfCVgj9mqZxdLZRupc8NRJA3+1r2CTjdbDpF1h6c2bozZ+gclV3i4pMjMi61sU5jzbyHD GKx1U2DOw/nxKHUfDd/URQMN3+reK09vYiRPQu7zTyh68s/BO4+EKLbggMOnZk+Qaw6tGm 3KHR26xqGVLr+Ivxcd6yqpw8S+gYShocz3Jgz4bl2oehi3wmiVaVmfnXCDyaBYAXh5d3P7 c40ZAjGUOPNY7IK6VLbtSRvKFoQIfxmtOE5QRR31NSfKyk7NffxnIn8sJu9CMYX+ZXRa0D Ufqkcj5hEfBKJigWdmB0PaRf9BtWHeHOFUAVxEZJ45gDf9s6+aTb0eaROS60JA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640810487; a=rsa-sha256; cv=none; b=SQ8IopI1g++bLiYonSfQjourPddc86myZbI4l7rZY0a5MIAWbjz2z63zbjuy9H/2vm+qXj Ukf6BhPAHLp07rGPAXQYQdGoHncbS8uNPDYsckFrqAktzZJkQnPOvQyHR51hEDJI/HtxqV stzkDh9sfochz06+u2g3ZGtFN0yZ2ONfY7MwSGHgqTkP3m+BNnGieqZPj3kD5e7fXrVnCh Cpbe7fRCUO+qIyWb2i3/YuHVoQfypsxaOfMFnFE+WpOxv+z2W8RsqMljtN19NYbwQxZejh hQzt0eANPMDxs3fOvV4Nx4oEpLW0AxQpqELxYZ1TRhGYEcVUfwk+a2O+626TPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=33812d60b9601d7ef8a7222c063696bfd6a77f41 commit 33812d60b9601d7ef8a7222c063696bfd6a77f41 Author: Colin Percival AuthorDate: 2021-12-20 17:55:36 +0000 Commit: Colin Percival CommitDate: 2021-12-29 20:41:09 +0000 vfs_mountroot: Check for root dev before waiting If GEOM is idle but the root device is not yet present when we enter vfs_mountroot_wait_if_necessary, we call vfs_mountroot_wait to wait for root holds (e.g. CAM or USB initialization). Upon returning from vfs_mountroot_wait, we wait 100 ms at a time until the root device shows up. Since the root device most likely appeared during vfs_mountroot_wait -- waiting for subsystems which may be responsible for the root device is the whole purpose of that function -- it makes sense to check if the device is now present rather than printing a warning and pausing for 100 ms before checking. Reviewed by: trasz Fixes: a3ba3d09c248 Make root mount wait mechanism smarter Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D33593 --- sys/kern/vfs_mountroot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index 6257f9592d86..d8ad5cf2989b 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -1040,6 +1040,8 @@ vfs_mountroot_wait_if_neccessary(const char *fs, const char *dev) * to behave exactly as it used to work before. */ vfs_mountroot_wait(); + if (parse_mount_dev_present(dev)) + return (0); printf("mountroot: waiting for device %s...\n", dev); delay = hz / 10; timeout = root_mount_timeout * hz;