Assert that cc_exec_drain(cc, direct) is NULL before assigning a new value.

Suggested by:	markj@
Tested by:	callout_test
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2020-09-02 10:00:30 +00:00
parent 0d0053d7ed
commit 624677fad7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365238

View File

@ -1269,6 +1269,9 @@ _callout_stop_safe(struct callout *c, int flags, callout_func_t *drain)
CTR3(KTR_CALLOUT, "postponing stop %p func %p arg %p",
c, c->c_func, c->c_arg);
if (drain) {
KASSERT(cc_exec_drain(cc, direct) == NULL,
("callout drain function already set to %p",
cc_exec_drain(cc, direct)));
cc_exec_drain(cc, direct) = drain;
}
CC_UNLOCK(cc);
@ -1277,6 +1280,9 @@ _callout_stop_safe(struct callout *c, int flags, callout_func_t *drain)
CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p",
c, c->c_func, c->c_arg);
if (drain) {
KASSERT(cc_exec_drain(cc, direct) == NULL,
("callout drain function already set to %p",
cc_exec_drain(cc, direct)));
cc_exec_drain(cc, direct) = drain;
}
}