summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-08-01 13:35:38 +0000
committerjhb <jhb@FreeBSD.org>2002-08-01 13:35:38 +0000
commita20667249ea3dd50ed661b39d30476958a826d67 (patch)
tree26f84d226370d3aaa0b90ab4f5e6465a0baf47ba /sys/kern/kern_shutdown.c
parent292ee3bd86be278e35b95da5aa6bcb21fe4720f4 (diff)
downloadFreeBSD-src-a20667249ea3dd50ed661b39d30476958a826d67.zip
FreeBSD-src-a20667249ea3dd50ed661b39d30476958a826d67.tar.gz
If we fail to write to a vnode during a ktrace write, then we drop all
other references to that vnode as a trace vnode in other processes as well as in any pending requests on the todo list. Thus, it is possible for a ktrace request structure to have a NULL ktr_vp when it is destroyed in ktr_freerequest(). We shouldn't call vrele() on the vnode in that case. Reported by: bde
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 13a9c7a..ec740ec 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -420,7 +420,7 @@ shutdown_reset(void *junk, int howto)
}
#ifdef SMP
-static u_int panic_cpu = NOCPU;
+static uintptr_t panic_thread = NULL;
#endif
/*
@@ -441,15 +441,17 @@ panic(const char *fmt, ...)
#ifdef SMP
/*
* We don't want multiple CPU's to panic at the same time, so we
- * use panic_cpu as a simple spinlock. We have to keep checking
- * panic_cpu if we are spinning in case the panic on the first
+ * use panic_thread as a simple spinlock. We have to keep checking
+ * panic_thread if we are spinning in case the panic on the first
* CPU is canceled.
*/
- if (panic_cpu != PCPU_GET(cpuid))
- while (atomic_cmpset_int(&panic_cpu, NOCPU,
- PCPU_GET(cpuid)) == 0)
- while (panic_cpu != NOCPU)
- ; /* nothing */
+ if (panic_thread != curthread)
+ while (atomic_cmpset_ptr(&panic_thread, NULL, curthread) == 0)
+ while (panic_thread != NULL) {
+#ifdef __i386__
+ ia32_pause();
+#endif
+ }
#endif
bootopt = RB_AUTOBOOT | RB_DUMP;
@@ -481,7 +483,7 @@ panic(const char *fmt, ...)
/* See if the user aborted the panic, in which case we continue. */
if (panicstr == NULL) {
#ifdef SMP
- atomic_store_rel_int(&panic_cpu, NOCPU);
+ atomic_store_rel_ptr(&panic_thread, NULL);
#endif
return;
}
OpenPOWER on IntegriCloud