Skip to content

Commit

Permalink
3973 zfs_ioc_rename alters passed in zc->zc_name
Browse files Browse the repository at this point in the history
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Christopher Siden <christopher.siden@delphix.com>
  • Loading branch information
Steven Hartland authored and Christopher Siden committed Aug 6, 2013
1 parent 7c6d702 commit a0c1127
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions usr/src/uts/common/fs/zfs/zfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a0c1127

Please sign in to comment.