Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Apr 2017 17:13:56 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r316708 - stable/11/sys/kern
Message-ID:  <201704111713.v3BHDuAQ049058@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)) {
 			



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704111713.v3BHDuAQ049058>