mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 10:21:01 +03:00
Fix error message on promoting encrypted dataset
This patch corrects the error message reported when attempting to promote a dataset outside of its encryption root. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #8905 Closes #8935
This commit is contained in:
parent
cc7fe8a599
commit
bfe5f029cf
@ -4117,6 +4117,16 @@ zfs_promote(zfs_handle_t *zhp)
|
|||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
|
case EACCES:
|
||||||
|
/*
|
||||||
|
* Promoting encrypted dataset outside its
|
||||||
|
* encryption root.
|
||||||
|
*/
|
||||||
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
|
"cannot promote dataset outside its "
|
||||||
|
"encryption root"));
|
||||||
|
return (zfs_error(hdl, EZFS_EXISTS, errbuf));
|
||||||
|
|
||||||
case EEXIST:
|
case EEXIST:
|
||||||
/* There is a conflicting snapshot name. */
|
/* There is a conflicting snapshot name. */
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
|
@ -1676,11 +1676,15 @@ dsl_dataset_promote_crypt_check(dsl_dir_t *target, dsl_dir_t *origin)
|
|||||||
* Check that the parent of the target has the same encryption root.
|
* Check that the parent of the target has the same encryption root.
|
||||||
*/
|
*/
|
||||||
ret = dsl_dir_get_encryption_root_ddobj(origin->dd_parent, &op_rddobj);
|
ret = dsl_dir_get_encryption_root_ddobj(origin->dd_parent, &op_rddobj);
|
||||||
if (ret != 0)
|
if (ret == ENOENT)
|
||||||
|
return (SET_ERROR(EACCES));
|
||||||
|
else if (ret != 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
||||||
ret = dsl_dir_get_encryption_root_ddobj(target->dd_parent, &tp_rddobj);
|
ret = dsl_dir_get_encryption_root_ddobj(target->dd_parent, &tp_rddobj);
|
||||||
if (ret != 0)
|
if (ret == ENOENT)
|
||||||
|
return (SET_ERROR(EACCES));
|
||||||
|
else if (ret != 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
||||||
if (op_rddobj != tp_rddobj)
|
if (op_rddobj != tp_rddobj)
|
||||||
|
Loading…
Reference in New Issue
Block a user