Author: kib
Date: Wed Aug  3 07:11:19 2016
New Revision: 303703
URL: https://svnweb.freebsd.org/changeset/base/303703

Log:
  Explain why swapgeom_close_ev() is delegated.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c    Wed Aug  3 07:10:09 2016        (r303702)
+++ head/sys/vm/swap_pager.c    Wed Aug  3 07:11:19 2016        (r303703)
@@ -2431,8 +2431,9 @@ swapgeom_acquire(struct g_consumer *cp)
 }
 
 /*
- * Remove a reference from the g_consumer. Post a close event if
- * all references go away.
+ * Remove a reference from the g_consumer.  Post a close event if all
+ * references go away, since the function might be called from the
+ * biodone context.
  */
 static void
 swapgeom_release(struct g_consumer *cp, struct swdevt *sp)
@@ -2555,7 +2556,12 @@ swapgeom_close(struct thread *td, struct
        cp = sw->sw_id;
        sw->sw_id = NULL;
        mtx_unlock(&sw_dev_mtx);
-       /* XXX: direct call when Giant untangled */
+
+       /*
+        * swapgeom_close() may be called from the biodone context,
+        * where we cannot perform topology changes.  Delegate the
+        * work to the events thread.
+        */
        if (cp != NULL)
                g_waitfor_event(swapgeom_close_ev, cp, M_WAITOK, NULL);
 }
_______________________________________________
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