mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-13 11:40:25 +03:00
Illumos #3973
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> References: https://www.illumos.org/issues/3973 illumos/illumos-gate@a0c1127b14 Ported-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #1775
This commit is contained in:
parent
6389d42205
commit
9554185d90
@ -3550,18 +3550,25 @@ zfs_ioc_rename(zfs_cmd_t *zc)
|
|||||||
at = strchr(zc->zc_name, '@');
|
at = strchr(zc->zc_name, '@');
|
||||||
if (at != NULL) {
|
if (at != NULL) {
|
||||||
/* snaps must be in same fs */
|
/* snaps must be in same fs */
|
||||||
|
int error;
|
||||||
|
|
||||||
if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1))
|
if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1))
|
||||||
return (SET_ERROR(EXDEV));
|
return (SET_ERROR(EXDEV));
|
||||||
*at = '\0';
|
*at = '\0';
|
||||||
if (zc->zc_objset_type == DMU_OST_ZFS) {
|
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_unmount, at + 1,
|
||||||
recursive ? DS_FIND_CHILDREN : 0);
|
recursive ? DS_FIND_CHILDREN : 0);
|
||||||
if (error != 0)
|
if (error != 0) {
|
||||||
|
*at = '@';
|
||||||
return (error);
|
return (error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (dsl_dataset_rename_snapshot(zc->zc_name,
|
error = dsl_dataset_rename_snapshot(zc->zc_name,
|
||||||
at + 1, strchr(zc->zc_value, '@') + 1, recursive));
|
at + 1, strchr(zc->zc_value, '@') + 1, recursive);
|
||||||
|
*at = '@';
|
||||||
|
|
||||||
|
return (error);
|
||||||
} else {
|
} else {
|
||||||
err = dsl_dir_rename(zc->zc_name, zc->zc_value);
|
err = dsl_dir_rename(zc->zc_name, zc->zc_value);
|
||||||
if (!err && zc->zc_objset_type == DMU_OST_ZVOL) {
|
if (!err && zc->zc_objset_type == DMU_OST_ZVOL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user