# HG changeset patch # User Steven Hartland # Date 1375811440 28800 # Node ID b0233279e3fc997aa00297b1e5a45287c75a95b1 # Parent 417f3f83e896151fa8a238aa3fc94978912f2ed1 3973 zfs_ioc_rename alters passed in zc->zc_name Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Christopher Siden diff -r 417f3f83e896 -r b0233279e3fc usr/src/uts/common/fs/zfs/zfs_ioctl.c --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c Mon Feb 13 19:50:26 2012 +0000 +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c Tue Aug 06 09:50:40 2013 -0800 @@ -3552,18 +3552,25 @@ at = strchr(zc->zc_name, '@'); if (at != NULL) { /* snaps must be in same fs */ + int error; + if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1)) return (SET_ERROR(EXDEV)); *at = '\0'; if (zc->zc_objset_type == DMU_OST_ZFS) { - int error = dmu_objset_find(zc->zc_name, + error = dmu_objset_find(zc->zc_name, recursive_unmount, at + 1, recursive ? DS_FIND_CHILDREN : 0); - if (error != 0) + if (error != 0) { + *at = '@'; return (error); + } } - return (dsl_dataset_rename_snapshot(zc->zc_name, - at + 1, strchr(zc->zc_value, '@') + 1, recursive)); + error = dsl_dataset_rename_snapshot(zc->zc_name, + at + 1, strchr(zc->zc_value, '@') + 1, recursive); + *at = '@'; + + return (error); } else { if (zc->zc_objset_type == DMU_OST_ZVOL) (void) zvol_remove_minor(zc->zc_name);