mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Remove no-op spl's and most comment references to spls, as TCP locking
is believed to be basically done (modulo any remaining bugs). MFC after: 3 days
This commit is contained in:
parent
b77634d046
commit
f59a9ebf10
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148156
@ -866,7 +866,7 @@ tcp_notify(inp, error)
|
||||
static int
|
||||
tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int error, i, n, s;
|
||||
int error, i, n;
|
||||
struct inpcb *inp, **inp_list;
|
||||
inp_gen_t gencnt;
|
||||
struct xinpgen xig;
|
||||
@ -888,12 +888,10 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
/*
|
||||
* OK, now we're committed to doing something.
|
||||
*/
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
gencnt = tcbinfo.ipi_gencnt;
|
||||
n = tcbinfo.ipi_count;
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
|
||||
error = sysctl_wire_old_buffer(req, 2 * (sizeof xig)
|
||||
+ n * sizeof(struct xtcpcb));
|
||||
@ -912,7 +910,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
if (inp_list == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp != NULL && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
@ -935,7 +932,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
INP_UNLOCK(inp);
|
||||
}
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
n = i;
|
||||
|
||||
error = 0;
|
||||
@ -975,13 +971,11 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
* while we were processing this request, and it
|
||||
* might be necessary to retry.
|
||||
*/
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
xig.xig_gen = tcbinfo.ipi_gencnt;
|
||||
xig.xig_sogen = so_gencnt;
|
||||
xig.xig_count = tcbinfo.ipi_count;
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
error = SYSCTL_OUT(req, &xig, sizeof xig);
|
||||
}
|
||||
free(inp_list, M_TEMP);
|
||||
@ -997,7 +991,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
|
||||
struct xucred xuc;
|
||||
struct sockaddr_in addrs[2];
|
||||
struct inpcb *inp;
|
||||
int error, s;
|
||||
int error;
|
||||
|
||||
error = suser_cred(req->td->td_ucred, SUSER_ALLOWJAIL);
|
||||
if (error)
|
||||
@ -1005,7 +999,6 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
|
||||
error = SYSCTL_IN(req, addrs, sizeof(addrs));
|
||||
if (error)
|
||||
return (error);
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
inp = in_pcblookup_hash(&tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
|
||||
addrs[0].sin_addr, addrs[0].sin_port, 0, NULL);
|
||||
@ -1026,7 +1019,6 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
|
||||
INP_UNLOCK(inp);
|
||||
outunlocked:
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
if (error == 0)
|
||||
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
|
||||
return (error);
|
||||
@ -1044,7 +1036,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
struct sockaddr_in6 addrs[2];
|
||||
struct in6_addr a6[2];
|
||||
struct inpcb *inp;
|
||||
int error, s, mapped = 0;
|
||||
int error, mapped = 0;
|
||||
|
||||
error = suser_cred(req->td->td_ucred, SUSER_ALLOWJAIL);
|
||||
if (error)
|
||||
@ -1065,7 +1057,6 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
if (error)
|
||||
return (EINVAL);
|
||||
}
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
if (mapped == 1)
|
||||
inp = in_pcblookup_hash(&tcbinfo,
|
||||
@ -1094,7 +1085,6 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
INP_UNLOCK(inp);
|
||||
outunlocked:
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
if (error == 0)
|
||||
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
|
||||
return (error);
|
||||
@ -1121,7 +1111,7 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
struct icmp *icp;
|
||||
struct in_conninfo inc;
|
||||
tcp_seq icmp_tcp_seq;
|
||||
int mtu, s;
|
||||
int mtu;
|
||||
|
||||
faddr = ((struct sockaddr_in *)sa)->sin_addr;
|
||||
if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY)
|
||||
@ -1152,7 +1142,6 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0)
|
||||
return;
|
||||
if (ip != NULL) {
|
||||
s = splnet();
|
||||
icp = (struct icmp *)((caddr_t)ip
|
||||
- offsetof(struct icmp, icmp_ip));
|
||||
th = (struct tcphdr *)((caddr_t)ip
|
||||
@ -1219,7 +1208,6 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
syncache_unreach(&inc, th);
|
||||
}
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
} else
|
||||
in_pcbnotifyall(&tcbinfo, faddr, inetctlerrmap[cmd], notify);
|
||||
}
|
||||
|
@ -499,7 +499,6 @@ syncache_unreach(inc, th)
|
||||
|
||||
INP_INFO_WLOCK_ASSERT(&tcbinfo);
|
||||
|
||||
/* we are called at splnet() here */
|
||||
sc = syncache_lookup(inc, &sch);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
|
@ -305,26 +305,22 @@ tcp_timer_keep(xtp)
|
||||
{
|
||||
struct tcpcb *tp = xtp;
|
||||
struct tcptemp *t_template;
|
||||
int s;
|
||||
struct inpcb *inp;
|
||||
#ifdef TCPDEBUG
|
||||
int ostate;
|
||||
|
||||
ostate = tp->t_state;
|
||||
#endif
|
||||
s = splnet();
|
||||
INP_INFO_WLOCK(&tcbinfo);
|
||||
inp = tp->t_inpcb;
|
||||
if (!inp) {
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
INP_LOCK(inp);
|
||||
if (callout_pending(tp->tt_keep) || !callout_active(tp->tt_keep)) {
|
||||
INP_UNLOCK(inp);
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
callout_deactivate(tp->tt_keep);
|
||||
@ -370,7 +366,6 @@ tcp_timer_keep(xtp)
|
||||
#endif
|
||||
INP_UNLOCK(inp);
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
|
||||
dropit:
|
||||
@ -385,7 +380,6 @@ tcp_timer_keep(xtp)
|
||||
if (tp)
|
||||
INP_UNLOCK(tp->t_inpcb);
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
@ -393,26 +387,22 @@ tcp_timer_persist(xtp)
|
||||
void *xtp;
|
||||
{
|
||||
struct tcpcb *tp = xtp;
|
||||
int s;
|
||||
struct inpcb *inp;
|
||||
#ifdef TCPDEBUG
|
||||
int ostate;
|
||||
|
||||
ostate = tp->t_state;
|
||||
#endif
|
||||
s = splnet();
|
||||
INP_INFO_WLOCK(&tcbinfo);
|
||||
inp = tp->t_inpcb;
|
||||
if (!inp) {
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
INP_LOCK(inp);
|
||||
if (callout_pending(tp->tt_persist) || !callout_active(tp->tt_persist)){
|
||||
INP_UNLOCK(inp);
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
callout_deactivate(tp->tt_persist);
|
||||
@ -449,7 +439,6 @@ tcp_timer_persist(xtp)
|
||||
if (tp)
|
||||
INP_UNLOCK(inp);
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
@ -457,7 +446,6 @@ tcp_timer_rexmt(xtp)
|
||||
void *xtp;
|
||||
{
|
||||
struct tcpcb *tp = xtp;
|
||||
int s;
|
||||
int rexmt;
|
||||
int headlocked;
|
||||
struct inpcb *inp;
|
||||
@ -466,20 +454,17 @@ tcp_timer_rexmt(xtp)
|
||||
|
||||
ostate = tp->t_state;
|
||||
#endif
|
||||
s = splnet();
|
||||
INP_INFO_WLOCK(&tcbinfo);
|
||||
headlocked = 1;
|
||||
inp = tp->t_inpcb;
|
||||
if (!inp) {
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
INP_LOCK(inp);
|
||||
if (callout_pending(tp->tt_rexmt) || !callout_active(tp->tt_rexmt)) {
|
||||
INP_UNLOCK(inp);
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
callout_deactivate(tp->tt_rexmt);
|
||||
@ -603,5 +588,4 @@ tcp_timer_rexmt(xtp)
|
||||
INP_UNLOCK(inp);
|
||||
if (headlocked)
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ tcp_notify(inp, error)
|
||||
static int
|
||||
tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int error, i, n, s;
|
||||
int error, i, n;
|
||||
struct inpcb *inp, **inp_list;
|
||||
inp_gen_t gencnt;
|
||||
struct xinpgen xig;
|
||||
@ -888,12 +888,10 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
/*
|
||||
* OK, now we're committed to doing something.
|
||||
*/
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
gencnt = tcbinfo.ipi_gencnt;
|
||||
n = tcbinfo.ipi_count;
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
|
||||
error = sysctl_wire_old_buffer(req, 2 * (sizeof xig)
|
||||
+ n * sizeof(struct xtcpcb));
|
||||
@ -912,7 +910,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
if (inp_list == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp != NULL && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
@ -935,7 +932,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
INP_UNLOCK(inp);
|
||||
}
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
n = i;
|
||||
|
||||
error = 0;
|
||||
@ -975,13 +971,11 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
* while we were processing this request, and it
|
||||
* might be necessary to retry.
|
||||
*/
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
xig.xig_gen = tcbinfo.ipi_gencnt;
|
||||
xig.xig_sogen = so_gencnt;
|
||||
xig.xig_count = tcbinfo.ipi_count;
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
error = SYSCTL_OUT(req, &xig, sizeof xig);
|
||||
}
|
||||
free(inp_list, M_TEMP);
|
||||
@ -997,7 +991,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
|
||||
struct xucred xuc;
|
||||
struct sockaddr_in addrs[2];
|
||||
struct inpcb *inp;
|
||||
int error, s;
|
||||
int error;
|
||||
|
||||
error = suser_cred(req->td->td_ucred, SUSER_ALLOWJAIL);
|
||||
if (error)
|
||||
@ -1005,7 +999,6 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
|
||||
error = SYSCTL_IN(req, addrs, sizeof(addrs));
|
||||
if (error)
|
||||
return (error);
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
inp = in_pcblookup_hash(&tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
|
||||
addrs[0].sin_addr, addrs[0].sin_port, 0, NULL);
|
||||
@ -1026,7 +1019,6 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
|
||||
INP_UNLOCK(inp);
|
||||
outunlocked:
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
if (error == 0)
|
||||
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
|
||||
return (error);
|
||||
@ -1044,7 +1036,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
struct sockaddr_in6 addrs[2];
|
||||
struct in6_addr a6[2];
|
||||
struct inpcb *inp;
|
||||
int error, s, mapped = 0;
|
||||
int error, mapped = 0;
|
||||
|
||||
error = suser_cred(req->td->td_ucred, SUSER_ALLOWJAIL);
|
||||
if (error)
|
||||
@ -1065,7 +1057,6 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
if (error)
|
||||
return (EINVAL);
|
||||
}
|
||||
s = splnet();
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
if (mapped == 1)
|
||||
inp = in_pcblookup_hash(&tcbinfo,
|
||||
@ -1094,7 +1085,6 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
|
||||
INP_UNLOCK(inp);
|
||||
outunlocked:
|
||||
INP_INFO_RUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
if (error == 0)
|
||||
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
|
||||
return (error);
|
||||
@ -1121,7 +1111,7 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
struct icmp *icp;
|
||||
struct in_conninfo inc;
|
||||
tcp_seq icmp_tcp_seq;
|
||||
int mtu, s;
|
||||
int mtu;
|
||||
|
||||
faddr = ((struct sockaddr_in *)sa)->sin_addr;
|
||||
if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY)
|
||||
@ -1152,7 +1142,6 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0)
|
||||
return;
|
||||
if (ip != NULL) {
|
||||
s = splnet();
|
||||
icp = (struct icmp *)((caddr_t)ip
|
||||
- offsetof(struct icmp, icmp_ip));
|
||||
th = (struct tcphdr *)((caddr_t)ip
|
||||
@ -1219,7 +1208,6 @@ tcp_ctlinput(cmd, sa, vip)
|
||||
syncache_unreach(&inc, th);
|
||||
}
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
splx(s);
|
||||
} else
|
||||
in_pcbnotifyall(&tcbinfo, faddr, inetctlerrmap[cmd], notify);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user