Unverified Commit e464f7c7 authored by Mariusz Zaborski's avatar Mariusz Zaborski Committed by GitHub
Browse files

FreeBSD: bring back possibility to rewind the checkpoint from bootloader

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: f2c027bd

External-issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254152


Originally reviewed by: tsoome, allanjude
Originally reviewed by: kevans (ok from high-level overview)
Reviewed-by: default avatarRyan Moeller <ryan@iXsystems.com>
Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: default avatarMariusz Zaborski <oshogbo@vexillium.org>
Closes #11730 
parent f845b2dd
base NAS-113163 NAS-116738 NAS-116738-prev NAS-117105 NAS-117807 NAS-117807-1 NAS-117845-dbg NAS-117845-dbg2-ozfs-mater NAS-117880 NAS-119759-1 NAS-121790 NAS-122915 NAS-122949 NAS-123279-2 NAS-124189-cobia NAS-124564 NAS-124699 NAS-124699-2 NAS-124699-3 NAS-124699-3-test NAS-125150 NAS-125882 NAS-125882-2 NAS-125916 NAS-125916-1 NAS-127352 NAS-127352-tn NAS-127702 NAS-127702-1 NAS-127702-df NAS-127822 NAS-127822-debug NAS-127888 NAS-127888-truenas TS-23.10 add-check-for-cached-acl-in-zpl_permission add-ctldir-snapcount add-fd-to-zhandle add-json-output-to-zfs add-xattr-related-flag allow-path-to-zhandle-in-ctldir backport-large_block dragonfish/zfs-2.2.4-staging experiment-with-createtxg fix-abi fix-archive-behavior fix-dosmode-behavior-linux freebsd-simplify-trivial-acl-check integrate master nfsacl nfsacl-1 nfsacl-a nfsacl-review nfsv4acl nfsv4acls ozfs_master_test pkg-test raidz-expansion-rebase rel-v0.0.1 release-test/22.02.3 release/21.06-BETA.1 release/21.08-BETA.1 release/21.08-BETA.2 release/22.02 release/22.02-RC.1 release/22.02-RC.2 release/22.02-test release/22.02.1 release/22.02.2 release/22.02.3 release/22.02.4 release/22.12 release/22.12-BETA.1 release/22.12-BETA.2 release/22.12-RC.1 release/22.12.1 release/22.12.2 release/22.12.3 release/22.12.3.3 release/22.12.4 release/22.2-RC.1 release/23.10-BETA.1 release/23.10-RC.1 release/23.10.0 release/23.10.1 release/23.10.1.2 release/23.10.1.3 release/23.10.2 release/24.04-BETA.1 release/24.04-RC.1 release/24.04.0 set-sast-config-1 stable/angelfish stable/bluefin stable/cobia stable/dragonfish streaminfo_xattr test test-ci test-inode-owner-change test-linux-stat-zfscltdir test_pkg testing-refine-branchout-process testing-refine-branchout-process2 testing/fix-sendrecv tmprelease/test-21.08 tmprelease/test-21.09 tmprelease/test2-21.09 tmprelease/test3-21.09 tmprelease/test4-21.09 tn_master truenas/13.0-u5.3-stable truenas/NAS-127822-debug truenas/dragonfish-2.2.2-test truenas/zfs-2.1-release truenas/zfs-2.1.13-upstream truenas/zfs-2.2-release truenas/zfs-2.2.1-hutter truenas/zfs-2.2.1-hutter2 truenas/zfs-2.2.1-release truenas/zfs-2.2.1-release-dragonfish truenas/zfs-2.2.3-staging-dragonfish truenas/zfs-2.2.3-testing truenas/zfs-2.2.4-staging truenas/zfs-2.3-release truenas/zfs-2.3-testing truenas/zfs-cobia-rc1-test truenas/zvol-multi-taskq truenas/zvol-multiq truenas/zvol-multiq-clean truenas/zvol-thread-property zfetch_reorder zfetch_reorder10 zfs-2.1-release zfs-issue-13217 zfs-json zfs-ozfs-master zvol-cleanup zvol-improvements-2.2.1 zvol-ro-property zvol-thread-property zvol_multi_taskq zvol_multiq zfs-2.1.99 zfs-2.1.2 zfs-2.1.1 zfs-2.1.0 zfs-2.1.0-rc8 zfs-2.1.0-rc7 zfs-2.1.0-rc6 zfs-2.1.0-rc5 zfs-2.1.0-rc4 zfs-2.1.0-rc3 zfs-2.1.0-rc2 zfs-2.1.0-rc1 TS-24.04-RC.1 TS-24.04-BETA.1 TS-23.10.2 TS-23.10.1.3 TS-23.10.1.2 TS-23.10.1.1 TS-23.10.1 TS-23.10.0.1 TS-23.10.0 TS-23.10-RC.1 TS-23.10-BETA.1 TS-22.12.4.2 TS-22.12.4.1 TS-22.12.4 TS-22.12.3.3 TS-22.12.3.2 TS-22.12.3.1 TS-22.12.3 TS-22.12.2 TS-22.12.1 TS-22.12.0 TS-22.12-RC.1 TS-22.12-BETA.2 TS-22.12-BETA.1 TS-22.12-ALPHA.1 TS-22.02.4 TS-22.02.3 TS-22.02.2.1 TS-22.02.2 TS-22.02.1 TS-22.2.1 TS-22.02.0.1 TS-22.02.0 TS-22.2.0 TS-22.02.RELEASE.1 TS-22.02-RC.2 TS-22.02-RC.1 TS-22.02-RC.1-2 TS-22.02-RC.1-1 TS-21.08-BETA.2 TS-21.08-BETA.1 TS-21.06-BETA.1 TS-12.12.3 DN110M-CS-v2.0
No related merge requests found
Showing with 16 additions and 1 deletion
+16 -1
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment