diff options
author | zec <zec@FreeBSD.org> | 2009-08-28 19:12:44 +0000 |
---|---|---|
committer | zec <zec@FreeBSD.org> | 2009-08-28 19:12:44 +0000 |
commit | b21e4c23c7f5385828b03c37f0117a9b6dde6511 (patch) | |
tree | 5c83641e0cd1d3610fff94ba3878ce1d0aab0977 /sys/rpc/svc_dg.c | |
parent | 6535dfe0714c7c2702d887a78943954aff43a0eb (diff) | |
download | FreeBSD-src-b21e4c23c7f5385828b03c37f0117a9b6dde6511.zip FreeBSD-src-b21e4c23c7f5385828b03c37f0117a9b6dde6511.tar.gz |
MFC r196503:
Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet
context inside the RPC code.
Temporarily set td's cred to mount's cred before calling socreate() via
__rpc_nconf2socket().
Submitted by: rmacklem (in part)
Reviewed by: rmacklem, rwatson
Discussed with: dfr, bz
Approved by: re (rwatson), julian (mentor)
Approved by: re (rwatson)
Diffstat (limited to 'sys/rpc/svc_dg.c')
-rw-r--r-- | sys/rpc/svc_dg.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/rpc/svc_dg.c b/sys/rpc/svc_dg.c index 0747d1d..9d7696b 100644 --- a/sys/rpc/svc_dg.c +++ b/sys/rpc/svc_dg.c @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/uio.h> +#include <net/vnet.h> + #include <rpc/rpc.h> #include <rpc/rpc_com.h> @@ -101,8 +103,10 @@ svc_dg_create(SVCPOOL *pool, struct socket *so, size_t sendsize, struct sockaddr* sa; int error; + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { printf(svc_dg_str, svc_dg_err1); + CURVNET_RESTORE(); return (NULL); } /* @@ -112,6 +116,7 @@ svc_dg_create(SVCPOOL *pool, struct socket *so, size_t sendsize, recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize); if ((sendsize == 0) || (recvsize == 0)) { printf(svc_dg_str, svc_dg_err2); + CURVNET_RESTORE(); return (NULL); } @@ -124,6 +129,7 @@ svc_dg_create(SVCPOOL *pool, struct socket *so, size_t sendsize, xprt->xp_ops = &svc_dg_ops; error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); + CURVNET_RESTORE(); if (error) goto freedata; |