Page MenuHomeFreeBSD

D5221.id13097.diff
No OneTemporary

D5221.id13097.diff

Index: sys/kern/kern_timeout.c
===================================================================
--- sys/kern/kern_timeout.c
+++ sys/kern/kern_timeout.c
@@ -1162,7 +1162,7 @@
int direct, sq_locked, use_lock;
int not_on_a_list;
- if (safe)
+ if ((safe & CS_DRAIN) != 0)
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c->c_lock,
"calling %s", __func__);
@@ -1170,7 +1170,7 @@
* Some old subsystems don't hold Giant while running a callout_stop(),
* so just discard this check for the moment.
*/
- if (!safe && c->c_lock != NULL) {
+ if ((safe & CS_DRAIN) == 0 && c->c_lock != NULL) {
if (c->c_lock == &Giant.lock_object)
use_lock = mtx_owned(&Giant);
else {
@@ -1253,7 +1253,7 @@
return (-1);
}
- if (safe) {
+ if ((safe & CS_DRAIN) != 0) {
/*
* The current callout is running (or just
* about to run) and blocking is allowed, so
@@ -1370,7 +1370,7 @@
cc_exec_drain(cc, direct) = drain;
}
CC_UNLOCK(cc);
- return (0);
+ return ((safe & CS_MIGRBLOCK) != 0);
}
CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p",
c, c->c_func, c->c_arg);
Index: sys/kern/subr_sleepqueue.c
===================================================================
--- sys/kern/subr_sleepqueue.c
+++ sys/kern/subr_sleepqueue.c
@@ -586,7 +586,8 @@
* another CPU, so synchronize with it to avoid having it
* accidentally wake up a subsequent sleep.
*/
- else if (callout_stop(&td->td_slpcallout) == 0) {
+ else if (_callout_stop_safe(&td->td_slpcallout, CS_MIGRBLOCK, NULL)
+ == 0) {
td->td_flags |= TDF_TIMEOUT;
TD_SET_SLEEPING(td);
mi_switch(SW_INVOL | SWT_SLEEPQTIMO, NULL);
Index: sys/sys/callout.h
===================================================================
--- sys/sys/callout.h
+++ sys/sys/callout.h
@@ -62,6 +62,9 @@
struct callout *callout;
};
+#define CS_DRAIN 0x0001
+#define CS_MIGRBLOCK 0x0002
+
#ifdef _KERNEL
/*
* Note the flags field is actually *two* fields. The c_flags
@@ -81,7 +84,7 @@
*/
#define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE)
#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE)
-#define callout_drain(c) _callout_stop_safe(c, 1, NULL)
+#define callout_drain(c) _callout_stop_safe(c, CS_DRAIN, NULL)
void callout_init(struct callout *, int);
void _callout_init_lock(struct callout *, struct lock_object *, int);
#define callout_init_mtx(c, mtx, flags) \

File Metadata

Mime Type
text/plain
Expires
Sun, May 17, 2:51 AM (18 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33169400
Default Alt Text
D5221.id13097.diff (2 KB)

Event Timeline