mirror_zfs/lib/libzfs
Andriy Gapon 8ca78ab002 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
2017-07-04 15:29:52 -07:00
..
.gitignore Add a pkgconfig file 2014-08-28 07:59:43 -07:00
libzfs_changelist.c OpenZFS 6931 - lib/libzfs: cleanup gcc warnings 2017-02-07 14:02:27 -08:00
libzfs_config.c OpenZFS 4521 - zfstest is trying to execute evil "zfs unmount -a" 2017-02-03 13:24:44 -08:00
libzfs_core.pc.in Add a pkgconfig file 2014-08-28 07:59:43 -07:00
libzfs_dataset.c OpenZFS 7600 - zfs rollback should pass target snapshot to kernel 2017-07-04 15:29:52 -07:00
libzfs_diff.c OpenZFS 6931 - lib/libzfs: cleanup gcc warnings 2017-02-07 14:02:27 -08:00
libzfs_fru.c OpenZFS 8046 - Let calloc() do the multiplication in libzfs_fru_refresh 2017-04-09 16:07:42 -07:00
libzfs_import.c Fix import finding spare/l2cache when path changes 2017-06-01 06:38:04 -07:00
libzfs_iter.c GCC 7.1 fixes 2017-06-28 10:05:16 -07:00
libzfs_mount.c OpenZFS 8430 - dir_is_empty_readdir() doesn't properly handle error from fdopendir() 2017-06-30 11:11:01 -07:00
libzfs_pool.c Implemented zpool sync command 2017-05-19 12:33:11 -07:00
libzfs_sendrecv.c GCC 7.1 fixes 2017-06-28 10:05:16 -07:00
libzfs_status.c Add zfs_nicebytes() to print human-readable sizes 2017-05-02 13:43:53 -07:00
libzfs_util.c Dashes for zero latency values in zpool iostat -p 2017-06-22 09:39:01 -07:00
libzfs.pc.in Add a pkgconfig file 2014-08-28 07:59:43 -07:00
Makefile.am Add -c to zpool iostat & status to run command 2016-11-29 14:45:38 -07:00