From 3bc485ddc56dcc24c598e57f7d537e482160dde3 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 24 Sep 2024 18:43:54 -0400 Subject: [PATCH] Properly release key in spa_keystore_dsl_key_hold_dd() Since dsl_crypto_key_open() references the key, 0d23f5e2e4 should have called dsl_crypto_key_rele() to drop it first instead of calling dsl_crypto_key_free() directly. The final result should actually be the same, but without triggering dck_holds assertion. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- module/zfs/dsl_crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/dsl_crypt.c b/module/zfs/dsl_crypt.c index 8e1055d9bcb1..8e7bf07bbda1 100644 --- a/module/zfs/dsl_crypt.c +++ b/module/zfs/dsl_crypt.c @@ -717,7 +717,7 @@ spa_keystore_dsl_key_hold_dd(spa_t *spa, dsl_dir_t *dd, const void *tag, avl_insert(&spa->spa_keystore.sk_dsl_keys, dck_io, where); *dck_out = dck_io; } else { - dsl_crypto_key_free(dck_io); + dsl_crypto_key_rele(dck_io, tag); *dck_out = dck_ks; }