mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
zfs_ioc_unload_key can drop extra spa ref
Reviewed by: Thomas Caputi <tcaputi@datto.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Don Brady <don.brady@delphix.com> Closes #7759
This commit is contained in:
parent
6da0998f59
commit
fc1ecd16d7
@ -469,8 +469,10 @@ dsl_crypto_can_set_keylocation(const char *dsname, const char *keylocation)
|
||||
goto out;
|
||||
|
||||
ret = dsl_dir_hold(dp, dsname, FTAG, &dd, NULL);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
dd = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* if dd is not encrypted, the value may only be "none" */
|
||||
if (dd->dd_crypto_obj == 0) {
|
||||
@ -778,8 +780,10 @@ spa_keystore_load_wkey(const char *dsname, dsl_crypto_params_t *dcp,
|
||||
|
||||
/* hold the dsl dir */
|
||||
ret = dsl_dir_hold(dp, dsname, FTAG, &dd, NULL);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
dd = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* initialize the wkey's ddobj */
|
||||
wkey->wk_ddobj = dd->dd_object;
|
||||
@ -904,8 +908,10 @@ spa_keystore_unload_wkey(const char *dsname)
|
||||
}
|
||||
|
||||
ret = dsl_dir_hold(dp, dsname, FTAG, &dd, NULL);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
dd = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* unload the wkey */
|
||||
ret = spa_keystore_unload_wkey_impl(dp->dp_spa, dd->dd_object);
|
||||
@ -1205,8 +1211,10 @@ spa_keystore_change_key_check(void *arg, dmu_tx_t *tx)
|
||||
|
||||
/* hold the dd */
|
||||
ret = dsl_dir_hold(dp, skcka->skcka_dsname, FTAG, &dd, NULL);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
dd = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* verify that the dataset is encrypted */
|
||||
if (dd->dd_crypto_obj == 0) {
|
||||
|
@ -501,7 +501,8 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
}
|
||||
if (tailp != NULL)
|
||||
*tailp = next;
|
||||
*ddp = dd;
|
||||
if (err == 0)
|
||||
*ddp = dd;
|
||||
error:
|
||||
kmem_free(buf, ZFS_MAX_DATASET_NAME_LEN);
|
||||
return (err);
|
||||
|
Loading…
Reference in New Issue
Block a user