diff options
author | rrs <rrs@FreeBSD.org> | 2007-09-08 11:35:11 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2007-09-08 11:35:11 +0000 |
commit | 4dd82bd675126ae3087b47d4425b57c8c44aa790 (patch) | |
tree | 33156f38f2aa559546f6d475b9777be0710945b3 /sys/netinet/sctp_pcb.c | |
parent | 8c4e364ee08a6259e006283ec6d3d38f50f37d5f (diff) | |
download | FreeBSD-src-4dd82bd675126ae3087b47d4425b57c8c44aa790.zip FreeBSD-src-4dd82bd675126ae3087b47d4425b57c8c44aa790.tar.gz |
- Locking compatiability changes. This involves adding
additional flags to many function calls. The flags only
get used in BSD when we compile with lock testing. These
flags allow apple to escape the "giant" lock it holds on
the socket and have more fine-grained locking in the NKE.
It also allows us to test (with witness) the locking used
by apple via a compile switch (manually applied).
Approved by: re@freebsd.org(B Mah)
Diffstat (limited to 'sys/netinet/sctp_pcb.c')
-rw-r--r-- | sys/netinet/sctp_pcb.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index fdec3e5..30fc1cb 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -611,7 +611,6 @@ out_now: } - static struct sctp_tcb * sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, struct sockaddr *to, struct sctp_nets **netp, uint32_t vrf_id) @@ -1243,7 +1242,6 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, return (NULL); } - struct sctp_inpcb * sctp_pcb_findep(struct sockaddr *nam, int find_tcp_pool, int have_lock, uint32_t vrf_id) @@ -2604,7 +2602,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 0); #endif - SCTP_ITERATOR_LOCK(); so = inp->sctp_socket; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { @@ -2650,11 +2647,11 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) cnt_in_sd = 0; for ((asoc = LIST_FIRST(&inp->sctp_asoc_list)); asoc != NULL; asoc = nasoc) { - nasoc = LIST_NEXT(asoc, sctp_tcblist); SCTP_TCB_LOCK(asoc); + nasoc = LIST_NEXT(asoc, sctp_tcblist); if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { /* Skip guys being freed */ - asoc->sctp_socket = NULL; + /* asoc->sctp_socket = NULL; FIXME MT */ cnt_in_sd++; SCTP_TCB_UNLOCK(asoc); continue; @@ -2668,7 +2665,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) * it wants the data to get across first. */ /* Just abandon things in the front states */ - if (sctp_free_assoc(inp, asoc, SCTP_PCBFREE_NOFORCE, SCTP_FROM_SCTP_PCB + SCTP_LOC_2) == 0) { cnt_in_sd++; @@ -2704,7 +2700,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_3); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_3; - sctp_send_abort_tcb(asoc, op_err); + sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { @@ -2738,7 +2734,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) asoc->asoc.primary_destination); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, asoc->asoc.primary_destination); - sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_CLOSING); + sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_SHUT_TMR, SCTP_SO_LOCKED); } } else { /* mark into shutdown pending */ @@ -2787,7 +2783,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_5); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_5; - sctp_send_abort_tcb(asoc, op_err); + sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { @@ -2800,7 +2796,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) } continue; } else { - sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_CLOSING); + sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); } } cnt_in_sd++; @@ -2864,7 +2860,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_7; - sctp_send_abort_tcb(asoc, op_err); + sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); } else if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { cnt++; @@ -3018,12 +3014,9 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) SCTP_INP_READ_DESTROY(inp); SCTP_ASOC_CREATE_LOCK_DESTROY(inp); SCTP_INP_INFO_WUNLOCK(); - SCTP_ITERATOR_UNLOCK(); - SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp); SCTP_DECR_EP_COUNT(); - } @@ -3780,7 +3773,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre int cnt = 0; /* first, lets purge the entry from the hash table. */ - SCTP_TCB_LOCK_ASSERT(stcb); #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, stcb, 6); @@ -5468,7 +5460,6 @@ sctp_set_primary_addr(struct sctp_tcb *stcb, struct sockaddr *sa, } } - int sctp_is_vtag_good(struct sctp_inpcb *inp, uint32_t tag, struct timeval *now) { @@ -5712,7 +5703,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb) asoc->last_revoke_count = cnt; (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); sctp_send_sack(stcb); - sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN); + sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN, SCTP_SO_NOT_LOCKED); reneged_asoc_ids[reneged_at] = sctp_get_associd(stcb); reneged_at++; } |