- When flushing node input queue, check whether item has a callback. If

it does, then call it suppling ENOENT as error value.
- Add assert, that helped to catch the above error.
This commit is contained in:
Gleb Smirnoff 2005-10-13 11:55:50 +00:00
parent 9cff52f7f6
commit eb2405dde8

View File

@ -2067,6 +2067,10 @@ ng_flush_input_queue(struct ng_queue * ngq)
atomic_add_long(&ngq->q_flags, add_arg);
mtx_unlock_spin(&ngq->q_mtx);
if (item->apply != NULL) {
(item->apply)(item->context, ENOENT);
item->apply = NULL;
}
NG_FREE_ITEM(item);
mtx_lock_spin(&ngq->q_mtx);
}
@ -2898,6 +2902,8 @@ ng_getqblk(int flags)
void
ng_free_item(item_p item)
{
KASSERT(item->apply == NULL, ("%s: leaking apply callback", __func__));
/*
* The item may hold resources on it's own. We need to free
* these before we can free the item. What they are depends upon