From owner-svn-src-all@freebsd.org Thu Nov 1 14:00:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4D5C10F3A5D; Thu, 1 Nov 2018 14:00:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B72B77277; Thu, 1 Nov 2018 14:00:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D90C1C9E9; Thu, 1 Nov 2018 14:00:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA1E0u4Q067139; Thu, 1 Nov 2018 14:00:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA1E0u0l067138; Thu, 1 Nov 2018 14:00:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201811011400.wA1E0u0l067138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 1 Nov 2018 14:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339994 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 339994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 14:00:57 -0000 Author: kevans Date: Thu Nov 1 14:00:56 2018 New Revision: 339994 URL: https://svnweb.freebsd.org/changeset/base/339994 Log: libbe(3): Don't promote non-cloned BEs Most easily reproducible by attempting to activate the currently activated BE, one would get a "not a cloned filesystem" error instead of success or a sane message. PR: 232488 MFC after: 3 days Modified: head/lib/libbe/be.c Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Thu Nov 1 13:29:55 2018 (r339993) +++ head/lib/libbe/be.c Thu Nov 1 14:00:56 2018 (r339994) @@ -928,7 +928,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, { char be_path[BE_MAXPATHLEN]; char buf[BE_MAXPATHLEN]; - nvlist_t *config, *vdevs; + nvlist_t *config, *dsprops, *vdevs; + char *origin; uint64_t pool_guid; zfs_handle_t *zhp; int err; @@ -969,7 +970,18 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, if (zhp == NULL) return (-1); - err = zfs_promote(zhp); + if (be_prop_list_alloc(&dsprops) != 0) + return (-1); + + if (be_get_dataset_props(lbh, be_path, dsprops) != 0) { + nvlist_free(dsprops); + return (-1); + } + + if (nvlist_lookup_string(dsprops, "origin", &origin) == 0) + err = zfs_promote(zhp); + nvlist_free(dsprops); + zfs_close(zhp); if (err)