summaryrefslogtreecommitdiff
path: root/sys/external/bsd/common/linux
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-12-19 12:11:36 +0000
committerriastradh <riastradh@NetBSD.org>2021-12-19 12:11:36 +0000
commitbb2ef8b0185717ea60de32ac28ce8cc07e60c2e9 (patch)
treed835a6ca3137370a72f7e5a9d5051e2ebcff3182 /sys/external/bsd/common/linux
parentd71f6c4bce6dce93d2f1f8e0545348da9913e5d0 (diff)
linux: Make flush_workqueue a noop if run from the workqueue.
I think this matches Linux semantics but this is very much not clear and not written down anywhere obvious and why is this such a semantically incoherent mess.
Diffstat (limited to 'sys/external/bsd/common/linux')
-rw-r--r--sys/external/bsd/common/linux/linux_work.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/external/bsd/common/linux/linux_work.c b/sys/external/bsd/common/linux/linux_work.c
index 752b83b0e89..d5863c2b119 100644
--- a/sys/external/bsd/common/linux/linux_work.c
+++ b/sys/external/bsd/common/linux/linux_work.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.57 2021/12/19 12:11:28 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.58 2021/12/19 12:11:36 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.57 2021/12/19 12:11:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.58 2021/12/19 12:11:36 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -1457,6 +1457,12 @@ flush_workqueue(struct workqueue_struct *wq)
{
struct flush_work fw;
+ if (lwp_getspecific(workqueue_key) == wq) {
+ printf("%s: running from workqueue %s\n", __func__,
+ wq->wq_name);
+ return;
+ }
+
mutex_init(&fw.fw_lock, MUTEX_DEFAULT, IPL_VM);
cv_init(&fw.fw_cv, "lxwqflsh");
INIT_WORK(&fw.fw_work, &flush_work_cb);