mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +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:
+10
-2
@@ -3738,9 +3738,12 @@ zfs_ioc_rename(zfs_cmd_t *zc)
|
||||
boolean_t recursive = zc->zc_cookie & 1;
|
||||
char *at;
|
||||
|
||||
/* "zfs rename" from and to ...%recv datasets should both fail */
|
||||
zc->zc_name[sizeof (zc->zc_name) - 1] = '\0';
|
||||
zc->zc_value[sizeof (zc->zc_value) - 1] = '\0';
|
||||
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
|
||||
strchr(zc->zc_value, '%'))
|
||||
if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 ||
|
||||
dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
|
||||
strchr(zc->zc_name, '%') || strchr(zc->zc_value, '%'))
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
at = strchr(zc->zc_name, '@');
|
||||
@@ -5002,6 +5005,11 @@ zfs_ioc_promote(zfs_cmd_t *zc)
|
||||
char *cp;
|
||||
int error;
|
||||
|
||||
zc->zc_name[sizeof (zc->zc_name) - 1] = '\0';
|
||||
if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 ||
|
||||
strchr(zc->zc_name, '%'))
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
error = dsl_pool_hold(zc->zc_name, FTAG, &dp);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
Reference in New Issue
Block a user