diff options
author | Matthew Ahrens <[email protected]> | 2013-08-14 11:42:31 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-11-05 12:23:11 -0800 |
commit | 46ba1e59d3ae7e374c7a98f15f4bef21ee3fcded (patch) | |
tree | 4088708419ecbaf33afbe3e9bb9e2f0aedebdf6d /module/zfs/zfs_ioctl.c | |
parent | 5d1f7fb647e8923d154901ef3e19676e7bf3d345 (diff) |
Illumos #3996
3996 want a libzfs_core API to rollback to latest snapshot
Reviewed by: Christopher Siden <[email protected]>
Reviewed by: Adam Leventhal <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Andy Stormont <[email protected]>
Approved by: Richard Lowe <[email protected]>
References:
https://www.illumos.org/issues/3996
illumos/illumos-gate@a7027df17fad220a20367b9d1eb251bc6300d203
Ported-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1775
Diffstat (limited to 'module/zfs/zfs_ioctl.c')
-rw-r--r-- | module/zfs/zfs_ioctl.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 4ad885ac6..8eb879d32 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3488,29 +3488,32 @@ zfs_ioc_destroy(zfs_cmd_t *zc) } /* - * inputs: - * zc_name name of dataset to rollback (to most recent snapshot) + * fsname is name of dataset to rollback (to most recent snapshot) * - * outputs: none + * innvl is not used. + * + * outnvl: "target" -> name of most recent snapshot + * } */ +/* ARGSUSED */ static int -zfs_ioc_rollback(zfs_cmd_t *zc) +zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl) { zfs_sb_t *zsb; int error; - if (get_zfs_sb(zc->zc_name, &zsb) == 0) { + if (get_zfs_sb(fsname, &zsb) == 0) { error = zfs_suspend_fs(zsb); if (error == 0) { int resume_err; - error = dsl_dataset_rollback(zc->zc_name, zsb); - resume_err = zfs_resume_fs(zsb, zc->zc_name); + error = dsl_dataset_rollback(fsname, zsb, outnvl); + resume_err = zfs_resume_fs(zsb, fsname); error = error ? error : resume_err; } deactivate_super(zsb->z_sb); } else { - error = dsl_dataset_rollback(zc->zc_name, NULL); + error = dsl_dataset_rollback(fsname, NULL, outnvl); } return (error); } @@ -5273,6 +5276,10 @@ zfs_ioctl_init(void) zfs_ioc_get_holds, zfs_secpolicy_read, DATASET_NAME, POOL_CHECK_SUSPENDED, B_FALSE, B_FALSE); + zfs_ioctl_register("rollback", ZFS_IOC_ROLLBACK, + zfs_ioc_rollback, zfs_secpolicy_rollback, DATASET_NAME, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_TRUE); + /* IOCTLS that use the legacy function signature */ zfs_ioctl_register_legacy(ZFS_IOC_POOL_FREEZE, zfs_ioc_pool_freeze, @@ -5384,8 +5391,6 @@ zfs_ioctl_init(void) zfs_secpolicy_none); zfs_ioctl_register_dataset_modify(ZFS_IOC_DESTROY, zfs_ioc_destroy, zfs_secpolicy_destroy); - zfs_ioctl_register_dataset_modify(ZFS_IOC_ROLLBACK, zfs_ioc_rollback, - zfs_secpolicy_rollback); zfs_ioctl_register_dataset_modify(ZFS_IOC_RENAME, zfs_ioc_rename, zfs_secpolicy_rename); zfs_ioctl_register_dataset_modify(ZFS_IOC_RECV, zfs_ioc_recv, |