From fa254605385ca8db5ce8594018b044e7e3091b5f Mon Sep 17 00:00:00 2001 From: George Amanakis Date: Tue, 28 Apr 2020 12:53:45 -0400 Subject: [PATCH] Add missing zfs_refcount_destroy() in key_mapping_rele() Otherwise when running with reference_tracking_enable=TRUE mounting and unmounting an encrypted dataset panics with: Call Trace: dump_stack+0x66/0x90 slab_err+0xcd/0xf2 ? __kmalloc+0x174/0x260 ? __kmem_cache_shutdown+0x158/0x240 __kmem_cache_shutdown.cold+0x1d/0x115 shutdown_cache+0x11/0x140 kmem_cache_destroy+0x210/0x230 spl_kmem_cache_destroy+0x122/0x3e0 [spl] zfs_refcount_fini+0x11/0x20 [zfs] spa_fini+0x4b/0x120 [zfs] zfs_kmod_fini+0x6b/0xa0 [zfs] _fini+0xa/0x68c [zfs] __x64_sys_delete_module+0x19c/0x2b0 do_syscall_64+0x5b/0x1a0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Reviewed-By: Brian Behlendorf Reviewed-By: Tom Caputi Signed-off-by: George Amanakis Closes #10246 --- module/zfs/dsl_crypt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zfs/dsl_crypt.c b/module/zfs/dsl_crypt.c index d69ccb122..eef4999b7 100644 --- a/module/zfs/dsl_crypt.c +++ b/module/zfs/dsl_crypt.c @@ -984,6 +984,7 @@ key_mapping_rele(spa_t *spa, dsl_key_mapping_t *km, void *tag) rw_exit(&spa->spa_keystore.sk_km_lock); spa_keystore_dsl_key_rele(spa, km->km_key, km); + zfs_refcount_destroy(&km->km_refcnt); kmem_free(km, sizeof (dsl_key_mapping_t)); }