Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev cgd(4): Wait for worker threads to complete before d...
details: https://anonhg.NetBSD.org/src/rev/7a335de55b96
branches: trunk
changeset: 1027625:7a335de55b96
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Dec 13 21:15:26 2021 +0000
description:
cgd(4): Wait for worker threads to complete before destroying mutex.
Fixes PR kern/56546 (probably!).
diffstat:
sys/dev/cgd.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r 59b23f5648a2 -r 7a335de55b96 sys/dev/cgd.c
--- a/sys/dev/cgd.c Mon Dec 13 20:53:22 2021 +0000
+++ b/sys/dev/cgd.c Mon Dec 13 21:15:26 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.140 2021/10/17 14:42:15 jmcneill Exp $ */
+/* $NetBSD: cgd.c,v 1.141 2021/12/13 21:15:26 riastradh Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.140 2021/10/17 14:42:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.141 2021/12/13 21:15:26 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -692,14 +692,20 @@
static void
cgd_destroy_worker(struct cgd_worker *cw)
{
+
+ /*
+ * Wait for all worker threads to complete before destroying
+ * the rest of the cgd_worker.
+ */
+ if (cw->cw_wq)
+ workqueue_destroy(cw->cw_wq);
+
mutex_destroy(&cw->cw_lock);
if (cw->cw_cpool) {
pool_destroy(cw->cw_cpool);
kmem_free(cw->cw_cpool, sizeof(struct pool));
}
- if (cw->cw_wq)
- workqueue_destroy(cw->cw_wq);
kmem_free(cw, sizeof(struct cgd_worker));
}
Home |
Main Index |
Thread Index |
Old Index