Author: markj
Date: Sun Dec 17 18:21:40 2017
New Revision: 326919
URL: https://svnweb.freebsd.org/changeset/base/326919

Log:
  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

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sun Dec 17 
06:00:49 2017        (r326918)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sun Dec 17 
18:21:40 2017        (r326919)
@@ -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
 }
 
 /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to