Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167454939
D8012.id20636.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1009 B
Referenced Files
None
Subscribers
None
D8012.id20636.diff
View Options
Index: sys/kern/subr_taskqueue.c
===================================================================
--- sys/kern/subr_taskqueue.c
+++ sys/kern/subr_taskqueue.c
@@ -558,9 +558,33 @@
taskqueue_drain_timeout(struct taskqueue *queue,
struct timeout_task *timeout_task)
{
+ u_int pending;
- callout_drain(&timeout_task->c);
- taskqueue_drain(queue, &timeout_task->t);
+ if (!queue->tq_spin)
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
+
+ do {
+ pending = 0;
+
+ callout_drain(&timeout_task->c);
+
+ TQ_LOCK(queue);
+ while (timeout_task->t.ta_pending != 0 ||
+ task_is_running(queue, &timeout_task->t)) {
+ TQ_SLEEP(queue, &timeout_task->t, &queue->tq_mutex,
+ PWAIT, "-", 0);
+ pending = 1;
+ }
+ TQ_UNLOCK(queue);
+
+ /*
+ * In case the taskqueue was pending we need to loop
+ * in order to fully drain, because the task we are
+ * draining might invoke the task again and restart
+ * the callout.
+ */
+
+ } while (pending != 0);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 22, 9:17 PM (4 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37109352
Default Alt Text
D8012.id20636.diff (1009 B)
Attached To
Mode
D8012: Fix race in taskqueue_drain_timeout()
Attached
Detach File
Event Timeline
Log In to Comment