diff --git a/sys/kern/subr_workqueue.c b/sys/kern/subr_workqueue.c index 811b4675b2dc..869ccf488d2c 100644 --- a/sys/kern/subr_workqueue.c +++ b/sys/kern/subr_workqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_workqueue.c,v 1.36 2018/02/06 03:48:39 ozaki-r Exp $ */ +/* $NetBSD: subr_workqueue.c,v 1.37 2018/06/13 05:26:12 ozaki-r Exp $ */ /*- * Copyright (c)2002, 2005, 2006, 2007 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.36 2018/02/06 03:48:39 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.37 2018/06/13 05:26:12 ozaki-r Exp $"); #include #include @@ -287,6 +287,8 @@ workqueue_q_wait(struct workqueue_queue *q, work_impl_t *wk_target) bool found = false; mutex_enter(&q->q_mutex); + if (q->q_worker == curlwp) + goto out; again: SIMPLEQ_FOREACH(wk, &q->q_queue_pending, wk_entry) { if (wk == wk_target) @@ -306,6 +308,7 @@ workqueue_q_wait(struct workqueue_queue *q, work_impl_t *wk_target) } if (q->q_waiter != NULL) q->q_waiter = NULL; + out: mutex_exit(&q->q_mutex); return found;