mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
zfs promote|rename .../%recv should be an error
If we are in the middle of an incremental 'zfs receive', the child .../%recv will exist. If we run 'zfs promote' .../%recv, it will "work", but then zfs gets confused about the status of the new dataset. Attempting to do this promote should be an error. Similarly renaming .../%recv datasets should not be allowed. Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #4843 Closes #6339
This commit is contained in:
@@ -3751,6 +3751,9 @@ zfs_promote(zfs_handle_t *zhp)
|
||||
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
|
||||
}
|
||||
|
||||
if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE))
|
||||
return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
|
||||
|
||||
ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname));
|
||||
|
||||
if (ret != 0) {
|
||||
@@ -4080,6 +4083,10 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
|
||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||
"cannot rename to '%s'"), target);
|
||||
|
||||
/* make sure source name is valid */
|
||||
if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE))
|
||||
return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
|
||||
|
||||
/*
|
||||
* Make sure the target name is valid
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user