summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Hartland <smh@freebsd.org>2013-08-06 09:50:40 -0800
committerChristopher Siden <chris.siden@delphix.com>2013-08-06 10:50:40 -0700
commita0c1127b147dc6a0372b141deb8c0c2b0195b8ea (patch)
tree4c18302305e6004ab9925bc1aef646071edc0e36
parent7c6d7024e51780d3aacf9063d2133c1e957d7eea (diff)
downloadillumos-joyent-a0c1127b147dc6a0372b141deb8c0c2b0195b8ea.tar.gz
3973 zfs_ioc_rename alters passed in zc->zc_name
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Christopher Siden <christopher.siden@delphix.com>
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_ioctl.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
index ec44fe871b..e8fd90459e 100644
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
@@ -3552,18 +3552,25 @@ zfs_ioc_rename(zfs_cmd_t *zc)
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);