From nobody Wed Jan 12 19:31:01 2022 X-Original-To: dev-commits-src-branches@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 42C2C1946B31; Wed, 12 Jan 2022 19:31:04 +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 4JYyN63Z4jz4qmq; Wed, 12 Jan 2022 19:31:02 +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 0987D12C8A; Wed, 12 Jan 2022 19:31:02 +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 20CJV1HA054125; Wed, 12 Jan 2022 19:31:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20CJV1Xt054124; Wed, 12 Jan 2022 19:31:01 GMT (envelope-from git) Date: Wed, 12 Jan 2022 19:31:01 GMT Message-Id: <202201121931.20CJV1Xt054124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 972796d007c2 - stable/13 - vfs_mountroot: Check for root dev before waiting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 972796d007c2bda481f50cf99d5531d5754ef2fa Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642015862; 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=/Vblr8TNJlVVWmIke8AU7519oJr/uBNtv4TYN1ESO4Q=; b=AA1Olty2ti5yvgzlTNjNhXfb7a75K4Y5Y4yHSrJpK7ODkGeS3oOBr3ac2nfFunV2X42goC aaax01MATH75vhb/3Y2y13yR/gLRJifE23ILsPyQY89x6N8tfECjuIyIZUxu5LIA69cAtN gDL7xrTtLQXYX2slEm5uFLCs2//Fu0WWnzSUCt8GB4EBipv47//abXPfCAqDVMVVbNjQCy bHSTt3TzgBxN1s2bvO1lZvGfzffuMiBA71O6GpU6bRnnQHAG8UBadadrf1btGdriW/XUIu NHNuya9/QNy2J731DZ5xaMXfsU1PyzR2xp0jPUdYY825OFtXI0dnbwnBzszsjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642015862; a=rsa-sha256; cv=none; b=CWJAC6mC88U49gQ+jnqGyCIZeuLDHq5A0MsJCkKQgEGU0kvrqudRkyiDZv62fQCku30arP fDFCss66N5KZQkPicYGrjnz+pOJCWEBx7geDnmR1Z3p3H/7wHkSKPajUxJo0xdyZOi/x+H Z4xk/OC52hNtv37QIpv8TxKTn9z8fsmAtgKNfOQUAHjIm7+ntDDICF9gnxxuaKz5pFqD+w VIgoPfzclqpYc//ZswUhxboJ7wK/nxS3dVxC7U+7jQcSsWVEk9htBhKDjeBFawpgIzsZtt LUAQcUIaDaR2RiGNp0AFOCBRlS1NfE5VPEJbxN7mSXBcKTKPPKqajdxEJFgtyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=972796d007c2bda481f50cf99d5531d5754ef2fa commit 972796d007c2bda481f50cf99d5531d5754ef2fa Author: Colin Percival AuthorDate: 2021-12-20 17:55:36 +0000 Commit: Colin Percival CommitDate: 2022-01-12 19:29:51 +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 (cherry picked from commit 33812d60b9601d7ef8a7222c063696bfd6a77f41) --- 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 851a9c839669..7e88a58fdb90 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -1041,6 +1041,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;