Module Name: src
Committed By: hannken
Date: Tue Jun 21 13:59:42 UTC 2011
Modified Files:
src/sys/dev: fss.c
Log Message:
Use kthread_join() to wait for the termination of the helper thread.
To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/fss.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/fss.c
diff -u src/sys/dev/fss.c:1.76 src/sys/dev/fss.c:1.77
--- src/sys/dev/fss.c:1.76 Tue Jun 21 12:41:24 2011
+++ src/sys/dev/fss.c Tue Jun 21 13:59:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.76 2011/06/21 12:41:24 hannken Exp $ */
+/* $NetBSD: fss.c,v 1.77 2011/06/21 13:59:41 hannken Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.76 2011/06/21 12:41:24 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.77 2011/06/21 13:59:41 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -455,8 +455,9 @@
}
sc->sc_flags |= FSS_BS_THREAD;
- if ((error = kthread_create(PRI_BIO, 0, NULL, fss_bs_thread, sc,
- &sc->sc_bs_lwp, "%s", device_xname(sc->sc_dev))) != 0) {
+ if ((error = kthread_create(PRI_BIO, KTHREAD_JOINABLE, NULL,
+ fss_bs_thread, sc, &sc->sc_bs_lwp,
+ "%s", device_xname(sc->sc_dev))) != 0) {
sc->sc_flags &= ~FSS_BS_THREAD;
return error;
}
@@ -478,9 +479,8 @@
mutex_enter(&sc->sc_slock);
sc->sc_flags &= ~FSS_BS_THREAD;
cv_signal(&sc->sc_work_cv);
- while (sc->sc_bs_lwp != NULL)
- kpause("fssdetach", false, 1, &sc->sc_slock);
mutex_exit(&sc->sc_slock);
+ kthread_join(sc->sc_bs_lwp);
disk_detach(sc->sc_dkdev);
}
@@ -1056,7 +1056,6 @@
cv_wait(&sc->sc_work_cv, &sc->sc_slock);
thread_idle = true;
if ((sc->sc_flags & FSS_BS_THREAD) == 0) {
- sc->sc_bs_lwp = NULL;
mutex_exit(&sc->sc_slock);
kthread_exit(0);
}