Broaden scope of the socket buffer lock when processing an ACK so that

the read and write of sb_cc are atomic.  Call sbdrop_locked() instead
of sbdrop() since we already hold the socket buffer lock.
This commit is contained in:
rwatson 2004-06-24 03:07:27 +00:00
parent 60a4c150d3
commit 72e8ca6e16
2 changed files with 8 additions and 4 deletions

View File

@ -2143,15 +2143,17 @@ tcp_input(m, off0)
incr = incr * incr / cw;
tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale);
}
SOCKBUF_LOCK(&so->so_snd);
if (acked > so->so_snd.sb_cc) {
tp->snd_wnd -= so->so_snd.sb_cc;
sbdrop(&so->so_snd, (int)so->so_snd.sb_cc);
sbdrop_locked(&so->so_snd, (int)so->so_snd.sb_cc);
ourfinisacked = 1;
} else {
sbdrop(&so->so_snd, acked);
sbdrop_locked(&so->so_snd, acked);
tp->snd_wnd -= acked;
ourfinisacked = 0;
}
SOCKBUF_UNLOCK(&so->so_snd);
sowwakeup(so);
/* detect una wraparound */
if ((tcp_do_newreno || tp->sack_enable) &&

View File

@ -2143,15 +2143,17 @@ tcp_input(m, off0)
incr = incr * incr / cw;
tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale);
}
SOCKBUF_LOCK(&so->so_snd);
if (acked > so->so_snd.sb_cc) {
tp->snd_wnd -= so->so_snd.sb_cc;
sbdrop(&so->so_snd, (int)so->so_snd.sb_cc);
sbdrop_locked(&so->so_snd, (int)so->so_snd.sb_cc);
ourfinisacked = 1;
} else {
sbdrop(&so->so_snd, acked);
sbdrop_locked(&so->so_snd, acked);
tp->snd_wnd -= acked;
ourfinisacked = 0;
}
SOCKBUF_UNLOCK(&so->so_snd);
sowwakeup(so);
/* detect una wraparound */
if ((tcp_do_newreno || tp->sack_enable) &&