summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2017-04-11 17:13:56 +0000
committermarkj <markj@FreeBSD.org>2017-04-11 17:13:56 +0000
commite87dbda4baca9928cb73b90c4635c686681dfc64 (patch)
tree264b3bbe35e410dc3c594dd4cd13c885ecfaa8a4
parentfaf2f8fd2b957b5f91ad4e0fc8d0d1286da85829 (diff)
downloadFreeBSD-src-e87dbda4baca9928cb73b90c4635c686681dfc64.zip
FreeBSD-src-e87dbda4baca9928cb73b90c4635c686681dfc64.tar.gz
MFC r315289:
When draining a callout, don't clear CALLOUT_ACTIVE while it is running.
-rw-r--r--sys/kern/kern_timeout.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 0fa898e..fe69bde 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -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)) {
OpenPOWER on IntegriCloud