]> granicus.if.org Git - zfs/commit
OpenZFS 7600 - zfs rollback should pass target snapshot to kernel
authorAndriy Gapon <avg@FreeBSD.org>
Sat, 11 Mar 2017 18:26:47 +0000 (20:26 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 4 Jul 2017 22:29:52 +0000 (15:29 -0700)
commit8ca78ab00278332a877d7d95e057c0b4aca5f9ad
tree60f894137651ee83fba59b74625fdd8798c66c8c
parent018503911c3a4d01768270c69e6ec87b3034e86f
OpenZFS 7600 - zfs rollback should pass target snapshot to kernel

Authored by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov>
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
include/libzfs_core.h
include/sys/dsl_dataset.h
lib/libzfs/libzfs_dataset.c
lib/libzfs_core/libzfs_core.c
module/zfs/dsl_dataset.c
module/zfs/zfs_ioctl.c