From owner-dev-commits-src-all@freebsd.org Fri Jul 16 17:46:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 913C6665224; Fri, 16 Jul 2021 17:46:49 +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 4GRJZx1lP2z3n2M; Fri, 16 Jul 2021 17:46:49 +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 1E98120CF1; Fri, 16 Jul 2021 17:46:49 +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 16GHkniB082146; Fri, 16 Jul 2021 17:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GHknJI082145; Fri, 16 Jul 2021 17:46:49 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:46:49 GMT Message-Id: <202107161746.16GHknJI082145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 66c5e65030ca - stable/12 - devmatch: don't announce autoloading so much MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 66c5e65030ca055ada3eae1c18cbbafe8131fa86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:46:49 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=66c5e65030ca055ada3eae1c18cbbafe8131fa86 commit 66c5e65030ca055ada3eae1c18cbbafe8131fa86 Author: Warner Losh AuthorDate: 2021-07-08 19:53:18 +0000 Commit: Warner Losh CommitDate: 2021-07-16 17:45:11 +0000 devmatch: don't announce autoloading so much devmatch rc script would announce it was loading a module multiple times. It used kldload -n so it really wasn't loading it that many times, but the message is confusing. Use kldstat to see if we need to load the module before saying we do. This fixes the vast majority of the problems. It may be possible to race devmatch with a user invocation and devd, though quite hard. In that case we'll announce things twice, but still only load it once. No attempt is made to fix this. PR: 232782 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index d48661ca9e15..cdea796c4689 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -71,8 +71,8 @@ devmatch_start() case "${x}" in *"#${m}#"*) continue ;; esac - echo "Autoloading module: ${m}" - kldload -n ${m} + kldstat -q -n ${m} || \ + (echo "Autoloading module: ${m}"; kldload -n ${m}) done devctl thaw }