From: Matthew Macy Date: Fri, 25 Oct 2019 20:42:54 +0000 (-0700) Subject: Move final zvol_remove_minors to common code X-Git-Tag: zfs-2.0.0~907 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c392c5aec06837aaf6d780fa6ba4dce5a84f6acb;p=mirror_zfs.git Move final zvol_remove_minors to common code This logic is not platform dependent and should reside in the common code. Reviewed-by: Igor Kozhukhov Reviewed-by: Jorgen Lundman Reviewed-by: Brian Behlendorf Signed-off-by: Matt Macy Closes #9505 --- diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 52725499a..f234b8544 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -1092,16 +1092,6 @@ zvol_init(void) void zvol_fini(void) { - zvol_remove_minors_impl(NULL); - - /* - * The call to "zvol_remove_minors_impl" may dispatch entries to - * the system_taskq, but it doesn't wait for those entires to - * complete before it returns. Thus, we must wait for all of the - * removals to finish, before we can continue. - */ - taskq_wait_outstanding(system_taskq, 0); - zvol_fini_impl(); blk_unregister_region(MKDEV(zvol_major, 0), 1UL << MINORBITS); unregister_blkdev(zvol_major, ZVOL_DRIVER); diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index 19c20afe7..5006b6af8 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -1713,6 +1713,16 @@ zvol_init_impl(void) void zvol_fini_impl(void) { + zvol_remove_minors_impl(NULL); + + /* + * The call to "zvol_remove_minors_impl" may dispatch entries to + * the system_taskq, but it doesn't wait for those entires to + * complete before it returns. Thus, we must wait for all of the + * removals to finish, before we can continue. + */ + taskq_wait_outstanding(system_taskq, 0); + kmem_free(zvol_htable, ZVOL_HT_SIZE * sizeof (struct hlist_head)); list_destroy(&zvol_state_list); rw_destroy(&zvol_state_lock);