svn commit: r316708 - stable/11/sys/kern

Mark Johnston markj at FreeBSD.org
Tue Apr 11 17:13:58 UTC 2017


Author: markj
Date: Tue Apr 11 17:13:56 2017
New Revision: 316708
URL: https://svnweb.freebsd.org/changeset/base/316708

Log:
  MFC r315289:
  When draining a callout, don't clear CALLOUT_ACTIVE while it is running.

Modified:
  stable/11/sys/kern/kern_timeout.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_timeout.c
==============================================================================
--- stable/11/sys/kern/kern_timeout.c	Tue Apr 11 17:06:52 2017	(r316707)
+++ stable/11/sys/kern/kern_timeout.c	Tue Apr 11 17:13:56 2017	(r316708)
@@ -1254,9 +1254,12 @@ again:
 	if (cc_exec_curr(cc, direct) == c) {
 		/*
 		 * Succeed we to stop it or not, we must clear the
-		 * active flag - this is what API users expect.
+		 * active flag - this is what API users expect.  If we're
+		 * draining and the callout is currently executing, first wait
+		 * until it finishes.
 		 */
-		c->c_flags &= ~CALLOUT_ACTIVE;
+		if ((flags & CS_DRAIN) == 0)
+			c->c_flags &= ~CALLOUT_ACTIVE;
 
 		if ((flags & CS_DRAIN) != 0) {
 			/*
@@ -1315,6 +1318,7 @@ again:
 				PICKUP_GIANT();
 				CC_LOCK(cc);
 			}
+			c->c_flags &= ~CALLOUT_ACTIVE;
 		} else if (use_lock &&
 			   !cc_exec_cancel(cc, direct) && (drain == NULL)) {
 			


More information about the svn-src-stable-11 mailing list