aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorTom Caputi <[email protected]>2019-10-30 14:27:28 -0400
committerBrian Behlendorf <[email protected]>2019-10-30 11:27:28 -0700
commitbae11ba8dc1dd992643dd0ab0b5cc3b3cc197fe9 (patch)
tree2916425363affd7edb4862b81ebff1afa539a7df /module/zfs
parentd46f0deb035bd26840dc6284fc6e1bb392097c92 (diff)
Fix 'zfs change-key' with unencrypted child
Currently, when you call 'zfs change-key' on an encrypted dataset that has an unencrypted child, the code will trigger a VERIFY. This VERIFY is leftover from before we allowed unencrypted datasets to exist underneath encrypted ones. This patch fixes the issue by simply replacing the VERIFY with an early return when recursing through datasets. Reviewed by: Jason King <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Signed-off-by: Tom Caputi <[email protected]> Closes #9524
Diffstat (limited to 'module/zfs')
-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 1545af53a..162a3613c 100644
--- a/module/zfs/dsl_crypt.c
+++ b/module/zfs/dsl_crypt.c
@@ -1430,6 +1430,7 @@ spa_keystore_change_key_sync_impl(uint64_t rddobj, uint64_t ddobj,
uint64_t new_rddobj, dsl_wrapping_key_t *wkey, boolean_t skip,
dmu_tx_t *tx)
{
+ int ret;
zap_cursor_t *zc;
zap_attribute_t *za;
dsl_pool_t *dp = dmu_tx_pool(tx);
@@ -1448,12 +1449,15 @@ spa_keystore_change_key_sync_impl(uint64_t rddobj, uint64_t ddobj,
return;
}
+ ret = dsl_dir_get_encryption_root_ddobj(dd, &curr_rddobj);
+ VERIFY(ret == 0 || ret == ENOENT);
+
/*
* Stop recursing if this dsl dir didn't inherit from the root
* or if this dd is a clone.
*/
- VERIFY0(dsl_dir_get_encryption_root_ddobj(dd, &curr_rddobj));
- if (!skip && (curr_rddobj != rddobj || dsl_dir_is_clone(dd))) {
+ if (ret == ENOENT ||
+ (!skip && (curr_rddobj != rddobj || dsl_dir_is_clone(dd)))) {
dsl_dir_rele(dd, FTAG);
return;
}