Author: tuexen
Date: Wed May 14 18:01:44 2014
New Revision: 266061
URL: http://svnweb.freebsd.org/changeset/base/266061

Log:
  MFC r258221:
  
  Cleanups which result in fixes which have been made upstream
  and where partially suggested by Andrew Galante.
  There is no functional change in FreeBSD.

Modified:
  stable/9/sys/netinet/sctp_bsd_addr.c
  stable/9/sys/netinet/sctp_pcb.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- stable/9/sys/netinet/sctp_bsd_addr.c        Wed May 14 17:45:10 2014        
(r266060)
+++ stable/9/sys/netinet/sctp_bsd_addr.c        Wed May 14 18:01:44 2014        
(r266061)
@@ -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,

Modified: stable/9/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/9/sys/netinet/sctp_pcb.c     Wed May 14 17:45:10 2014        
(r266060)
+++ stable/9/sys/netinet/sctp_pcb.c     Wed May 14 18:01:44 2014        
(r266061)
@@ -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_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_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_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) {
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to