When querying the local or foreign address from an IP socket, acquire
only a read lock on the inpcb. When an external module requests a read lock, acquire only a read lock. MFC after: 3 months
This commit is contained in:
parent
b27c1c8db7
commit
a69042a5be
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178318
@ -780,10 +780,10 @@ in_getsockaddr(struct socket *so, struct sockaddr **nam)
|
||||
inp = sotoinpcb(so);
|
||||
KASSERT(inp != NULL, ("in_getsockaddr: inp == NULL"));
|
||||
|
||||
INP_WLOCK(inp);
|
||||
INP_RLOCK(inp);
|
||||
port = inp->inp_lport;
|
||||
addr = inp->inp_laddr;
|
||||
INP_WUNLOCK(inp);
|
||||
INP_RUNLOCK(inp);
|
||||
|
||||
*nam = in_sockaddr(port, &addr);
|
||||
return 0;
|
||||
@ -799,10 +799,10 @@ in_getpeeraddr(struct socket *so, struct sockaddr **nam)
|
||||
inp = sotoinpcb(so);
|
||||
KASSERT(inp != NULL, ("in_getpeeraddr: inp == NULL"));
|
||||
|
||||
INP_WLOCK(inp);
|
||||
INP_RLOCK(inp);
|
||||
port = inp->inp_fport;
|
||||
addr = inp->inp_faddr;
|
||||
INP_WUNLOCK(inp);
|
||||
INP_RUNLOCK(inp);
|
||||
|
||||
*nam = in_sockaddr(port, &addr);
|
||||
return 0;
|
||||
@ -1228,14 +1228,14 @@ void
|
||||
inp_rlock(struct inpcb *inp)
|
||||
{
|
||||
|
||||
INP_WLOCK(inp);
|
||||
INP_RLOCK(inp);
|
||||
}
|
||||
|
||||
void
|
||||
inp_runlock(struct inpcb *inp)
|
||||
{
|
||||
|
||||
INP_WUNLOCK(inp);
|
||||
INP_RUNLOCK(inp);
|
||||
}
|
||||
|
||||
#ifdef INVARIANTS
|
||||
|
Loading…
Reference in New Issue
Block a user