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: f2c027bd6a
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: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>
Closes #11730
This commit is contained in:
parent
525a7037c7
commit
5a397fda09
|
@ -1290,6 +1290,18 @@ getpoolname(const char *osname, char *poolname)
|
||||||
return (0);
|
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*/
|
/*ARGSUSED*/
|
||||||
static int
|
static int
|
||||||
zfs_mount(vfs_t *vfsp)
|
zfs_mount(vfs_t *vfsp)
|
||||||
|
@ -1300,6 +1312,7 @@ zfs_mount(vfs_t *vfsp)
|
||||||
char *osname;
|
char *osname;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int canwrite;
|
int canwrite;
|
||||||
|
bool checkpointrewind;
|
||||||
|
|
||||||
if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL))
|
if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL))
|
||||||
return (SET_ERROR(EINVAL));
|
return (SET_ERROR(EINVAL));
|
||||||
|
@ -1313,6 +1326,8 @@ zfs_mount(vfs_t *vfsp)
|
||||||
secpolicy_fs_mount_clearopts(cr, vfsp);
|
secpolicy_fs_mount_clearopts(cr, vfsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetch_osname_options(osname, &checkpointrewind);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for mount privilege?
|
* Check for mount privilege?
|
||||||
*
|
*
|
||||||
|
@ -1391,7 +1406,7 @@ zfs_mount(vfs_t *vfsp)
|
||||||
|
|
||||||
error = getpoolname(osname, pname);
|
error = getpoolname(osname, pname);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = spa_import_rootpool(pname, false);
|
error = spa_import_rootpool(pname, checkpointrewind);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue