Skip to content

Commit b901d4a

Browse files
author
Umer Saleem
authored
Update the dataset name in handle after zfs_rename (#17040)
For zfs_rename, after the dataset name is successfully updated, the dataset handle that was passed to zfs_rename, still contains the old name, due to which, the dataset handle becomes invalid. The following operations performed using this handle result in error since the dataset with old name cannot be found anymore. changelist_rename does update the names in dataset handles, but those are temporary handles that were created during changelist_gather. The original handle that was used to call zfs_rename is not updated. We should update the name in original ZFS handle after the IOCTL for rename returns success for the operation. Signed-off-by: Umer Saleem <[email protected]> Reviewed-by: Ameer Hamza <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
1 parent b8c73ab commit b901d4a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/libzfs/libzfs_dataset.c

+1
Original file line numberDiff line numberDiff line change
@@ -4673,6 +4673,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags)
46734673
changelist_rename(cl, zfs_get_name(zhp), target);
46744674
ret = changelist_postfix(cl);
46754675
}
4676+
(void) strlcpy(zhp->zfs_name, target, sizeof (zhp->zfs_name));
46764677
}
46774678

46784679
error:

0 commit comments

Comments
 (0)