diff options
author | Andriy Gapon <[email protected]> | 2017-03-11 20:26:47 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-07-04 15:29:52 -0700 |
commit | 8ca78ab00278332a877d7d95e057c0b4aca5f9ad (patch) | |
tree | 60f894137651ee83fba59b74625fdd8798c66c8c /include | |
parent | 018503911c3a4d01768270c69e6ec87b3034e86f (diff) |
OpenZFS 7600 - zfs rollback should pass target snapshot to kernel
Authored by: Andriy Gapon <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Ported-by: Giuseppe Di Natale <[email protected]>
The existing kernel-side code only provides a method to rollback to a
latest snapshot, whatever it happens to be at the time when the rollback
is actually done. That could be unsafe or confusing in environments
where concurrent DSL changes are possible as the resulting state could
correspond to a newer or older snapshot than the originally requested
one.
This change allows to amend that method such that the rollback is
performed only when the latest snapshot has a specific name. That is,
if a new snapshot is concurrently created or the target snapshot is
destroyed, then no rollback is done and EXDEV error is returned.
New libzfs_core function lzc_rollback_to() is provided for the new
functionality. libzfs is changed to use lzc_rollback_to() to implement
zfs rollback command.
Perhaps we should return different errors to distinguish the case where
the desired snapshot exists but it's not the latest snapshot and the
case where the desired snapshot does not exist.
OpenZFS-issue: https://www.illumos.org/issues/7600
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3d645eb
Closes #6292
Diffstat (limited to 'include')
-rw-r--r-- | include/libzfs_core.h | 1 | ||||
-rw-r--r-- | include/sys/dsl_dataset.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/libzfs_core.h b/include/libzfs_core.h index cf7ea3837..b4f61151c 100644 --- a/include/libzfs_core.h +++ b/include/libzfs_core.h @@ -91,6 +91,7 @@ int lzc_receive_with_cmdprops(const char *, nvlist_t *, nvlist_t *, boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); +int lzc_rollback_to(const char *, const char *); int lzc_sync(const char *, nvlist_t *, nvlist_t **); diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h index f6499a760..50c1e9337 100644 --- a/include/sys/dsl_dataset.h +++ b/include/sys/dsl_dataset.h @@ -340,7 +340,8 @@ void dsl_dataset_set_refreservation_sync_impl(dsl_dataset_t *ds, void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx); boolean_t dsl_dataset_is_zapified(dsl_dataset_t *ds); boolean_t dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds); -int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result); +int dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner, + nvlist_t *result); void dsl_dataset_deactivate_feature(uint64_t dsobj, spa_feature_t f, dmu_tx_t *tx); |