aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-01-13 03:52:43 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 19:28:10 -0500
commit977ac3157328239a0f4074b13a3d9eb5c832cd6c (patch)
tree6b309227b39229a0afd1158c768f3a796e755791 /net/sunrpc
parentc2550e07a61a4528673fb85aaaee16048b7cf6cc (diff)
SUNRPC: register rpcbind programs in passed network namespase context
Registering rpcbind program requires rpcbind clients, which are per network namespace context. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/rpcb_clnt.c8
-rw-r--r--net/sunrpc/svc.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 0d76c0f09bb8..a5aa50d0aae4 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -425,7 +425,7 @@ static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg)
425 * IN6ADDR_ANY (ie available for all AF_INET and AF_INET6 425 * IN6ADDR_ANY (ie available for all AF_INET and AF_INET6
426 * addresses). 426 * addresses).
427 */ 427 */
428int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port) 428int rpcb_register(struct net *net, u32 prog, u32 vers, int prot, unsigned short port)
429{ 429{
430 struct rpcbind_args map = { 430 struct rpcbind_args map = {
431 .r_prog = prog, 431 .r_prog = prog,
@@ -436,7 +436,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port)
436 struct rpc_message msg = { 436 struct rpc_message msg = {
437 .rpc_argp = &map, 437 .rpc_argp = &map,
438 }; 438 };
439 struct sunrpc_net *sn = net_generic(&init_net, sunrpc_net_id); 439 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
440 440
441 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " 441 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
442 "rpcbind\n", (port ? "" : "un"), 442 "rpcbind\n", (port ? "" : "un"),
@@ -563,7 +563,7 @@ static int rpcb_unregister_all_protofamilies(struct sunrpc_net *sn,
563 * service on any IPv4 address, but not on IPv6. The latter 563 * service on any IPv4 address, but not on IPv6. The latter
564 * advertises the service on all IPv4 and IPv6 addresses. 564 * advertises the service on all IPv4 and IPv6 addresses.
565 */ 565 */
566int rpcb_v4_register(const u32 program, const u32 version, 566int rpcb_v4_register(struct net *net, const u32 program, const u32 version,
567 const struct sockaddr *address, const char *netid) 567 const struct sockaddr *address, const char *netid)
568{ 568{
569 struct rpcbind_args map = { 569 struct rpcbind_args map = {
@@ -575,7 +575,7 @@ int rpcb_v4_register(const u32 program, const u32 version,
575 struct rpc_message msg = { 575 struct rpc_message msg = {
576 .rpc_argp = &map, 576 .rpc_argp = &map,
577 }; 577 };
578 struct sunrpc_net *sn = net_generic(&init_net, sunrpc_net_id); 578 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
579 579
580 if (sn->rpcb_local_clnt4 == NULL) 580 if (sn->rpcb_local_clnt4 == NULL)
581 return -EPROTONOSUPPORT; 581 return -EPROTONOSUPPORT;
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index e4aabc02368b..889d7b11b9ac 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -818,7 +818,7 @@ static int __svc_rpcb_register4(const u32 program, const u32 version,
818 return -ENOPROTOOPT; 818 return -ENOPROTOOPT;
819 } 819 }
820 820
821 error = rpcb_v4_register(program, version, 821 error = rpcb_v4_register(&init_net, program, version,
822 (const struct sockaddr *)&sin, netid); 822 (const struct sockaddr *)&sin, netid);
823 823
824 /* 824 /*
@@ -826,7 +826,7 @@ static int __svc_rpcb_register4(const u32 program, const u32 version,
826 * registration request with the legacy rpcbind v2 protocol. 826 * registration request with the legacy rpcbind v2 protocol.
827 */ 827 */
828 if (error == -EPROTONOSUPPORT) 828 if (error == -EPROTONOSUPPORT)
829 error = rpcb_register(program, version, protocol, port); 829 error = rpcb_register(&init_net, program, version, protocol, port);
830 830
831 return error; 831 return error;
832} 832}
@@ -865,7 +865,7 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
865 return -ENOPROTOOPT; 865 return -ENOPROTOOPT;
866 } 866 }
867 867
868 error = rpcb_v4_register(program, version, 868 error = rpcb_v4_register(&init_net, program, version,
869 (const struct sockaddr *)&sin6, netid); 869 (const struct sockaddr *)&sin6, netid);
870 870
871 /* 871 /*
@@ -968,14 +968,14 @@ static void __svc_unregister(const u32 program, const u32 version,
968{ 968{
969 int error; 969 int error;
970 970
971 error = rpcb_v4_register(program, version, NULL, ""); 971 error = rpcb_v4_register(&init_net, program, version, NULL, "");
972 972
973 /* 973 /*
974 * User space didn't support rpcbind v4, so retry this 974 * User space didn't support rpcbind v4, so retry this
975 * request with the legacy rpcbind v2 protocol. 975 * request with the legacy rpcbind v2 protocol.
976 */ 976 */
977 if (error == -EPROTONOSUPPORT) 977 if (error == -EPROTONOSUPPORT)
978 error = rpcb_register(program, version, 0, 0); 978 error = rpcb_register(&init_net, program, version, 0, 0);
979 979
980 dprintk("svc: %s(%sv%u), error %d\n", 980 dprintk("svc: %s(%sv%u), error %d\n",
981 __func__, progname, version, error); 981 __func__, progname, version, error);