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
This commit is contained in:
Mark Johnston 2017-12-17 18:21:40 +00:00
parent 4927bbce9d
commit 7a177c2d5e

View File

@ -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
}
/*