Protect so_oobmark with with SOCKBUF_LOCK(&so->so_rcv), and broaden

locking in tcp_input() for TCP packets with urgent data pointers to
hold the socket buffer lock across testing and updating oobmark
from just protecting sb_state.

Update socket locking annotations
This commit is contained in:
Robert Watson 2004-06-24 02:57:12 +00:00
parent a82b25f9b2
commit 927c5cea3f
3 changed files with 7 additions and 9 deletions

View File

@ -2295,13 +2295,12 @@ tcp_input(m, off0)
*/
if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
tp->rcv_up = th->th_seq + th->th_urp;
SOCKBUF_LOCK(&so->so_rcv);
so->so_oobmark = so->so_rcv.sb_cc +
(tp->rcv_up - tp->rcv_nxt) - 1;
if (so->so_oobmark == 0) {
SOCKBUF_LOCK(&so->so_rcv);
if (so->so_oobmark == 0)
so->so_rcv.sb_state |= SBS_RCVATMARK;
SOCKBUF_UNLOCK(&so->so_rcv);
}
SOCKBUF_UNLOCK(&so->so_rcv);
sohasoutofband(so);
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
}

View File

@ -2295,13 +2295,12 @@ tcp_input(m, off0)
*/
if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
tp->rcv_up = th->th_seq + th->th_urp;
SOCKBUF_LOCK(&so->so_rcv);
so->so_oobmark = so->so_rcv.sb_cc +
(tp->rcv_up - tp->rcv_nxt) - 1;
if (so->so_oobmark == 0) {
SOCKBUF_LOCK(&so->so_rcv);
if (so->so_oobmark == 0)
so->so_rcv.sb_state |= SBS_RCVATMARK;
SOCKBUF_UNLOCK(&so->so_rcv);
}
SOCKBUF_UNLOCK(&so->so_rcv);
sohasoutofband(so);
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
}

View File

@ -88,7 +88,7 @@ struct socket {
u_short so_error; /* error affecting connection */
struct sigio *so_sigio; /* [sg] information for async I/O or
out of band data (SIGURG) */
u_long so_oobmark; /* chars to oob mark */
u_long so_oobmark; /* (c) chars to oob mark */
TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */
/*
* Variables for socket buffering.