Cleanups which result in fixes which have been made upstream
and where partially suggested by Andrew Galante. There is no functional change in FreeBSD. MFC after: 3 days
This commit is contained in:
parent
e6afd72b93
commit
f4f34bde23
@ -96,22 +96,12 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
||||
void
|
||||
sctp_startup_iterator(void)
|
||||
{
|
||||
static int called = 0;
|
||||
int ret;
|
||||
|
||||
if (called) {
|
||||
if (sctp_it_ctl.thread_proc) {
|
||||
/* You only get one */
|
||||
return;
|
||||
}
|
||||
/* init the iterator head */
|
||||
called = 1;
|
||||
sctp_it_ctl.iterator_running = 0;
|
||||
sctp_it_ctl.iterator_flags = 0;
|
||||
sctp_it_ctl.cur_it = NULL;
|
||||
SCTP_ITERATOR_LOCK_INIT();
|
||||
SCTP_IPI_ITERATOR_WQ_INIT();
|
||||
TAILQ_INIT(&sctp_it_ctl.iteratorhead);
|
||||
ret = kproc_create(sctp_iterator_thread,
|
||||
kproc_create(sctp_iterator_thread,
|
||||
(void *)NULL,
|
||||
&sctp_it_ctl.thread_proc,
|
||||
RFPROC,
|
||||
|
@ -5861,7 +5861,8 @@ sctp_pcb_init()
|
||||
for (i = 0; i < SCTP_STACK_VTAG_HASH_SIZE; i++) {
|
||||
LIST_INIT(&SCTP_BASE_INFO(vtag_timewait)[i]);
|
||||
}
|
||||
|
||||
SCTP_ITERATOR_LOCK_INIT();
|
||||
SCTP_IPI_ITERATOR_WQ_INIT();
|
||||
sctp_startup_iterator();
|
||||
|
||||
#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
|
||||
@ -5890,35 +5891,31 @@ sctp_pcb_finish(void)
|
||||
struct sctp_tagblock *twait_block, *prev_twait_block;
|
||||
struct sctp_laddr *wi, *nwi;
|
||||
int i;
|
||||
struct sctp_iterator *it, *nit;
|
||||
|
||||
/*
|
||||
* Free BSD the it thread never exits but we do clean up. The only
|
||||
* way freebsd reaches here if we have VRF's but we still add the
|
||||
* ifdef to make it compile on old versions.
|
||||
* In FreeBSD the iterator thread never exits but we do clean up.
|
||||
* The only way FreeBSD reaches here is if we have VRF's but we
|
||||
* still add the ifdef to make it compile on old versions.
|
||||
*/
|
||||
{
|
||||
struct sctp_iterator *it, *nit;
|
||||
|
||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||
TAILQ_FOREACH_SAFE(it, &sctp_it_ctl.iteratorhead, sctp_nxt_itr, nit) {
|
||||
if (it->vn != curvnet) {
|
||||
continue;
|
||||
}
|
||||
TAILQ_REMOVE(&sctp_it_ctl.iteratorhead, it, sctp_nxt_itr);
|
||||
if (it->function_atend != NULL) {
|
||||
(*it->function_atend) (it->pointer, it->val);
|
||||
}
|
||||
SCTP_FREE(it, SCTP_M_ITER);
|
||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||
TAILQ_FOREACH_SAFE(it, &sctp_it_ctl.iteratorhead, sctp_nxt_itr, nit) {
|
||||
if (it->vn != curvnet) {
|
||||
continue;
|
||||
}
|
||||
SCTP_IPI_ITERATOR_WQ_UNLOCK();
|
||||
SCTP_ITERATOR_LOCK();
|
||||
if ((sctp_it_ctl.cur_it) &&
|
||||
(sctp_it_ctl.cur_it->vn == curvnet)) {
|
||||
sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_STOP_CUR_IT;
|
||||
TAILQ_REMOVE(&sctp_it_ctl.iteratorhead, it, sctp_nxt_itr);
|
||||
if (it->function_atend != NULL) {
|
||||
(*it->function_atend) (it->pointer, it->val);
|
||||
}
|
||||
SCTP_ITERATOR_UNLOCK();
|
||||
SCTP_FREE(it, SCTP_M_ITER);
|
||||
}
|
||||
|
||||
SCTP_IPI_ITERATOR_WQ_UNLOCK();
|
||||
SCTP_ITERATOR_LOCK();
|
||||
if ((sctp_it_ctl.cur_it) &&
|
||||
(sctp_it_ctl.cur_it->vn == curvnet)) {
|
||||
sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_STOP_CUR_IT;
|
||||
}
|
||||
SCTP_ITERATOR_UNLOCK();
|
||||
SCTP_OS_TIMER_STOP(&SCTP_BASE_INFO(addr_wq_timer.timer));
|
||||
SCTP_WQ_ADDR_LOCK();
|
||||
LIST_FOREACH_SAFE(wi, &SCTP_BASE_INFO(addr_wq), sctp_nxt_addr, nwi) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user