From 7a177c2d5ec8dcce1ad8903118c0b56962192992 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sun, 17 Dec 2017 18:21:40 +0000 Subject: [PATCH] Unregister the ARC lowmem event handler earlier in arc_fini(). Otherwise a poorly timed lowmem event may attempt to acquire a destroyed lock. Unregister the handler before destroying the ARC reclaim thread. Reported by: gjb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D13480 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c index 209b33f16347..0cff5a70a55e 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -6619,6 +6619,11 @@ arc_init(void) void arc_fini(void) { +#ifdef _KERNEL + if (arc_event_lowmem != NULL) + EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); +#endif + mutex_enter(&arc_reclaim_lock); arc_reclaim_thread_exit = B_TRUE; /* @@ -6664,11 +6669,6 @@ arc_fini(void) buf_fini(); ASSERT0(arc_loaned_bytes); - -#ifdef _KERNEL - if (arc_event_lowmem != NULL) - EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); -#endif } /*