mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 13:01:10 +01:00
netgraph: Exit the net epoch to handle control messages
In general, in the direct dispatch case netgraph only enters the net epoch to send data messages, but this was inconsistent with the netgraph thread, which also entered the net epoch to send fn and fn2 messages to nodes. Some handlers, e.g., ng_bridge_newhook(), may sleep, and so cannot be called in epoch context; the netgraph tests occasionally panic due to this problem. Make ngthread() consistent with the direct dispatch path. Discussed with: afedorov (in D44615) MFC after: 2 weeks Sponsored by: Klara, Inc.
This commit is contained in:
parent
30cafaa961
commit
46f38a6ded
@ -3440,10 +3440,13 @@ ngthread(void *arg)
|
||||
NG_QUEUE_UNLOCK(&node->nd_input_queue);
|
||||
NGI_GET_NODE(item, node); /* zaps stored node */
|
||||
|
||||
if ((item->el_flags & NGQF_TYPE) == NGQF_MESG) {
|
||||
if ((item->el_flags & NGQF_TYPE) != NGQF_DATA) {
|
||||
/*
|
||||
* NGQF_MESG items should never be processed in
|
||||
* NET_EPOCH context. So, temporary exit from EPOCH.
|
||||
* NGQF_MESG, NGQF_FN and NGQF_FN2 items
|
||||
* should never be processed in
|
||||
* NET_EPOCH context; they generally
|
||||
* require heavier synchronization and
|
||||
* may sleep. So, temporarily exit.
|
||||
*/
|
||||
NET_EPOCH_EXIT(et);
|
||||
ng_apply_item(node, item, rw);
|
||||
|
Loading…
Reference in New Issue
Block a user