Set curvnet context inside the RPC code in more places.

Reviewed by:	melifaro
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D3398
This commit is contained in:
Xin LI 2015-08-18 18:12:46 +00:00
parent c8060fafd4
commit 2c98c61dad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286894
2 changed files with 10 additions and 0 deletions

View File

@ -703,7 +703,9 @@ __rpc_sockisbound(struct socket *so)
struct sockaddr *sa;
int error, bound;
CURVNET_SET(so->so_vnet);
error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
CURVNET_RESTORE();
if (error)
return (0);
@ -791,7 +793,9 @@ bindresvport(struct socket *so, struct sockaddr *sa)
socklen_t salen;
if (sa == NULL) {
CURVNET_SET(so->so_vnet);
error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
CURVNET_RESTORE();
if (error)
return (error);
freesa = TRUE;

View File

@ -150,7 +150,9 @@ svc_vc_create(SVCPOOL *pool, struct socket *so, size_t sendsize,
SOCK_LOCK(so);
if (so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED)) {
SOCK_UNLOCK(so);
CURVNET_SET(so->so_vnet);
error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa);
CURVNET_RESTORE();
if (error)
return (NULL);
xprt = svc_vc_create_conn(pool, so, sa);
@ -167,7 +169,9 @@ svc_vc_create(SVCPOOL *pool, struct socket *so, size_t sendsize,
xprt->xp_p2 = NULL;
xprt->xp_ops = &svc_vc_rendezvous_ops;
CURVNET_SET(so->so_vnet);
error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
CURVNET_RESTORE();
if (error) {
goto cleanup_svc_vc_create;
}
@ -249,7 +253,9 @@ svc_vc_create_conn(SVCPOOL *pool, struct socket *so, struct sockaddr *raddr)
memcpy(&xprt->xp_rtaddr, raddr, raddr->sa_len);
CURVNET_SET(so->so_vnet);
error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
CURVNET_RESTORE();
if (error)
goto cleanup_svc_vc_create;