From owner-dev-commits-src-all@freebsd.org Sat Mar 13 12:00:55 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 BC4CA574FFA; Sat, 13 Mar 2021 12:00:55 +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 4DyLqW4m70z4nBC; Sat, 13 Mar 2021 12:00:55 +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 96ABA2386; Sat, 13 Mar 2021 12:00:55 +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 12DC0tot014333; Sat, 13 Mar 2021 12:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DC0t1S014332; Sat, 13 Mar 2021 12:00:55 GMT (envelope-from git) Date: Sat, 13 Mar 2021 12:00:55 GMT Message-Id: <202103131200.12DC0t1S014332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 653ed678c703 - main - zfs: bring back possibility to rewind the checkpoint from MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 653ed678c70376b15cdc42daafa7b4554570cea2 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: Sat, 13 Mar 2021 12:00:55 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=653ed678c70376b15cdc42daafa7b4554570cea2 commit 653ed678c70376b15cdc42daafa7b4554570cea2 Author: Mariusz Zaborski AuthorDate: 2021-03-13 11:56:17 +0000 Commit: Mariusz Zaborski CommitDate: 2021-03-13 11:56:17 +0000 zfs: bring back possibility to rewind the checkpoint from Add parsing of the rewind options. When I was upstreaming the change [1], I omitted the part where we detect that the pool should be rewind. When the FreeBSD repo has synced with the OpenZFS, this part of the code was removed. [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a Originally reviewed by: tsoome, allanjude Originally reviewed by: kevans (ok from high-level overview) Signed-off-by: Mariusz Zaborski PR: 254152 Reported by: Zhenlei Huang Obtained from: https://github.com/openzfs/zfs/pull/11730 --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 7bc6b83d0272..a537342f9678 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -1291,6 +1291,18 @@ getpoolname(const char *osname, char *poolname) return (0); } +static void +fetch_osname_options(char *name, bool *checkpointrewind) +{ + + if (name[0] == '!') { + *checkpointrewind = true; + memmove(name, name + 1, strlen(name)); + } else { + *checkpointrewind = false; + } +} + /*ARGSUSED*/ static int zfs_mount(vfs_t *vfsp) @@ -1301,6 +1313,7 @@ zfs_mount(vfs_t *vfsp) char *osname; int error = 0; int canwrite; + bool checkpointrewind; if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (SET_ERROR(EINVAL)); @@ -1314,6 +1327,8 @@ zfs_mount(vfs_t *vfsp) secpolicy_fs_mount_clearopts(cr, vfsp); } + fetch_osname_options(osname, &checkpointrewind); + /* * Check for mount privilege? * @@ -1392,7 +1407,7 @@ zfs_mount(vfs_t *vfsp) error = getpoolname(osname, pname); if (error == 0) - error = spa_import_rootpool(pname, false); + error = spa_import_rootpool(pname, checkpointrewind); if (error) goto out; }