Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 2021 17:46:49 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 66c5e65030ca - stable/12 - devmatch: don't announce autoloading so much
Message-ID:  <202107161746.16GHknJI082145@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=66c5e65030ca055ada3eae1c18cbbafe8131fa86

commit 66c5e65030ca055ada3eae1c18cbbafe8131fa86
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-07-08 19:53:18 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
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
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107161746.16GHknJI082145>