From nobody Fri Jul 07 00:41:42 2023 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 4QxvjL4x3jz4lnPQ; Fri, 7 Jul 2023 00:41:42 +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 4QxvjL4QtKz3HTv; Fri, 7 Jul 2023 00:41:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688690502; 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=6oT5Lb2BIfg8R0h+nPN50lcseqtvPfMEPQDsWxydOTw=; b=cGHPVUZunHJVwwdtdm/QwGs3fT5FgDVMRRvaW/t2XfaJe9XCdvwICE5Rz5SWav/THVVM3e 7wdPlYEtjOkmJmJ6ypHtPj7P0tqwYMUb6WWdHJlWZhFTGItVFNc5ePM+laJuF0genLpwuJ WpVG4SrYarrdCKthEbKX/llgdTg99I+7W0EDAqO9NT5/ggx0M7wYHafTwUvv1IydLF1cJW RJrw6omU9VdLt9MIW99hp1dokIKuT19nhhYHBcaN+ocjgsLjO2S8zfBxJ5M9gtY/9HhZCz sw9eONWRYjgCFX2hJW0H4hbfd0HL1ShBzHTkadAv+yXseEq5zrOMnj1GxMfIXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688690502; 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=6oT5Lb2BIfg8R0h+nPN50lcseqtvPfMEPQDsWxydOTw=; b=hH/SlUkcxh/KA8e2+USfk4QVza1/TFMnItLBOkad+bTv7XzrzVdT72X77jyZVySacm2agg yY2BiY0RUwsGnaBHoOROZlJllNmin6ZNpmz0MgBO5CKuRlrOGNbXHm/xvsQ4gZiJPAvNGX g+KHzZfCEsdCBavbGDqEoaZvdriq1E1Ondlzh3nT9s/CDJM79EIZPSfhvSxNRWxTEt6QVN kNry3MEpPV+3Nn3RoGg7Mbfl3tX7Z7U8s3Os3tav52n71vsP9SjAWyMDDrKtz2GzsL0nza lMkp8uFMYbvtMEQ5BkZTd6AT/kmZ5BCtQ1sXSB1FNe6ljqkO+tn6fSru5LR4iQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688690502; a=rsa-sha256; cv=none; b=Sez38G0b7hVjYJot73vwKQbWftaYdW85vVO2jODiACGEJDavE/TttXV4G4jEm5KBKyZjZA 6fWq/VcTO2XL1fuYkMAnUH6dHocuxEayq92kBhywh1PIwyL1Gf4GmqyLG2NTsKJrOI9kr2 SNygFc0+QhkV1LzDKefLGKk3I1EIhPbl5uNd0niCy5c0TcnED1qU6ewCoegDaG/TBj+zPh I1n2M1DDFnILwImuwmAgXjGFe7+YQPF0/8E74cS84edmFH82CqEdgeY26axSwbcABKh77N UwDr9/X1nrZAhDJWpnX7EIFlHTWz0t4DUttE5d0PMzi3sfmWwuPlqZjAJ4q1cQ== 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 4QxvjL3WsjzJZC; Fri, 7 Jul 2023 00:41:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3670fg5o003297; Fri, 7 Jul 2023 00:41:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3670fg7S003296; Fri, 7 Jul 2023 00:41:42 GMT (envelope-from git) Date: Fri, 7 Jul 2023 00:41:42 GMT Message-Id: <202307070041.3670fg7S003296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 2f700ca965a0 - main - libbe: bail out early if the zfs kmod isn't loaded 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f700ca965a04c4a03b6f760da6a210b6ca4df4b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=2f700ca965a04c4a03b6f760da6a210b6ca4df4b commit 2f700ca965a04c4a03b6f760da6a210b6ca4df4b Author: Kyle Evans AuthorDate: 2023-07-07 00:41:14 +0000 Commit: Kyle Evans CommitDate: 2023-07-07 00:41:14 +0000 libbe: bail out early if the zfs kmod isn't loaded As noted in the comment, we already know the rest of libbe_init() will fail because there's no pool imported. Avoid the side effect by checking beforehand and bailing out early. With this, freebsd-update(8) should no longer trigger a load of the zfs kmod just because it runs `bectl check`. Reviewed by: jwmaag_gmail.com, rew Differential Revision: https://reviews.freebsd.org/D36188 --- lib/libbe/be.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index c4dec043fcb6..753fde746e31 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -119,6 +120,16 @@ libbe_init(const char *root) lbh = NULL; poolname = pos = NULL; + /* + * If the zfs kmod's not loaded then the later libzfs_init() will load + * the module for us, but that's not desirable for a couple reasons. If + * the module's not loaded, there's no pool imported and we're going to + * fail anyways. We also don't really want libbe consumers to have that + * kind of side-effect (module loading) in the general case. + */ + if (modfind("zfs") < 0) + goto err; + if ((lbh = calloc(1, sizeof(libbe_handle_t))) == NULL) goto err;