From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:26:15 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 B86DD4D02E8; Fri, 8 Jan 2021 17:26:15 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DC94R3XJ1z4gbt; Fri, 8 Jan 2021 17:26:15 +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 DC7F226FB2; Fri, 8 Jan 2021 17:26:14 +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 108HQETN066308; Fri, 8 Jan 2021 17:26:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108HQEWL066307; Fri, 8 Jan 2021 17:26:14 GMT (envelope-from git) Date: Fri, 8 Jan 2021 17:26:14 GMT Message-Id: <202101081726.108HQEWL066307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 7edc1bd9dc17 - main - When be_activate() turns on a new boot environment, it always deactivates the current one first. And if it fails to do so, it abandons activation. However, with the new bootonce feature, there is a legitimate case when a pool doesn't have "bootfs" property set. Check for this case before calling be_deactivate(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7edc1bd9dc174526c69246ba45bf2c8c230d38f4 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, 08 Jan 2021 17:26:15 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7edc1bd9dc174526c69246ba45bf2c8c230d38f4 commit 7edc1bd9dc174526c69246ba45bf2c8c230d38f4 Author: Gleb Smirnoff AuthorDate: 2021-01-08 17:23:16 +0000 Commit: Gleb Smirnoff CommitDate: 2021-01-08 17:23:16 +0000 When be_activate() turns on a new boot environment, it always deactivates the current one first. And if it fails to do so, it abandons activation. However, with the new bootonce feature, there is a legitimate case when a pool doesn't have "bootfs" property set. Check for this case before calling be_deactivate(). Reviewed by: kevans --- lib/libbe/be.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index 644cf90a6fd7..d6fe027f5df3 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -1263,7 +1263,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary) return (lzbe_set_boot_device( zpool_get_name(lbh->active_phandle), lzbe_add, be_path)); } else { - if (be_deactivate(lbh, lbh->bootfs, false) != 0) + if (strncmp(lbh->bootfs, "-", 1) != 0 && + be_deactivate(lbh, lbh->bootfs, false) != 0) return (-1); /* Obtain bootenv zpool */