summaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_crypt.c
diff options
context:
space:
mode:
authorTom Caputi <[email protected]>2019-06-24 19:42:52 -0400
committerBrian Behlendorf <[email protected]>2019-06-24 16:42:52 -0700
commit53864800f60b843b8212514428530adfa155211b (patch)
tree9b249dfd150a2c26bed6c4cea6b7f085db0b308b /module/zfs/dsl_crypt.c
parent8f12a4f8d2846ca668f8ad90d9ea5c19c8c0b78f (diff)
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 <[email protected]> Signed-off-by: Tom Caputi <[email protected]> Closes #8905 Closes #8935
Diffstat (limited to 'module/zfs/dsl_crypt.c')
-rw-r--r--module/zfs/dsl_crypt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/module/zfs/dsl_crypt.c b/module/zfs/dsl_crypt.c
index 0c0ffaadd..568fe7aa3 100644
--- a/module/zfs/dsl_crypt.c
+++ b/module/zfs/dsl_crypt.c
@@ -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.
*/
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);
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);
if (op_rddobj != tp_rddobj)