mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-31 03:04:11 +03:00
zdb: don't try to load key for unencrypted dataset
Previously using -K/--key on an unencrypted dataset would trip a VERIFY, because the dataset has nowhere to load the key into. Now, just ignore it. This makes zdb much easier to drive when there's a mix of encrypt and non-encrypted datasets, as the key can provided for all of them (at least, assuming the same encryption root, which is a common enough case). Sponsored-by: TrueNAS Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Signed-off-by: Rob Norris <rob.norris@truenas.com> Closes #18230
This commit is contained in:
committed by
Brian Behlendorf
parent
b021cb60aa
commit
9f874ad092
@@ -3481,6 +3481,14 @@ open_objset(const char *path, const void *tag, objset_t **osp)
|
|||||||
path, strerror(err));
|
path, strerror(err));
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only try to load the key and unlock the dataset if it is
|
||||||
|
* actually encrypted; otherwise we'll just crash. Just
|
||||||
|
* ignore the -K switch entirely otherwise; it's useful to be
|
||||||
|
* able to provide even if it's not needed.
|
||||||
|
*/
|
||||||
|
if ((*osp)->os_encrypted) {
|
||||||
dsl_dataset_long_hold(dmu_objset_ds(*osp), tag);
|
dsl_dataset_long_hold(dmu_objset_ds(*osp), tag);
|
||||||
dsl_pool_rele(dmu_objset_pool(*osp), tag);
|
dsl_pool_rele(dmu_objset_pool(*osp), tag);
|
||||||
|
|
||||||
@@ -3490,6 +3498,9 @@ open_objset(const char *path, const void *tag, objset_t **osp)
|
|||||||
/* release it all */
|
/* release it all */
|
||||||
dsl_dataset_long_rele(dmu_objset_ds(*osp), tag);
|
dsl_dataset_long_rele(dmu_objset_ds(*osp), tag);
|
||||||
dsl_dataset_rele(dmu_objset_ds(*osp), tag);
|
dsl_dataset_rele(dmu_objset_ds(*osp), tag);
|
||||||
|
} else {
|
||||||
|
dmu_objset_rele(*osp, tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ds_hold_flags = key_loaded ? DS_HOLD_FLAG_DECRYPT : 0;
|
int ds_hold_flags = key_loaded ? DS_HOLD_FLAG_DECRYPT : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user