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:
Robert Watson 2004-06-24 03:07:27 +00:00
parent 927c5cea3f
commit 5905999b2f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131018
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) &&