Commit 4cb54ca2 authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust

SUNRPC: search for service transports in network namespace context

Service transports are parametrized by network namespace. And thus lookup of
transport instance have to take network namespace into account.
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent babea479
...@@ -193,7 +193,7 @@ static int create_lockd_listener(struct svc_serv *serv, const char *name, ...@@ -193,7 +193,7 @@ static int create_lockd_listener(struct svc_serv *serv, const char *name,
{ {
struct svc_xprt *xprt; struct svc_xprt *xprt;
xprt = svc_find_xprt(serv, name, family, 0); xprt = svc_find_xprt(serv, name, &init_net, family, 0);
if (xprt == NULL) if (xprt == NULL)
return svc_create_xprt(serv, name, &init_net, family, port, return svc_create_xprt(serv, name, &init_net, family, port,
SVC_SOCK_DEFAULTS); SVC_SOCK_DEFAULTS);
......
...@@ -722,7 +722,7 @@ static ssize_t __write_ports_addxprt(char *buf) ...@@ -722,7 +722,7 @@ static ssize_t __write_ports_addxprt(char *buf)
nfsd_serv->sv_nrthreads--; nfsd_serv->sv_nrthreads--;
return 0; return 0;
out_close: out_close:
xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port); xprt = svc_find_xprt(nfsd_serv, transport, &init_net, PF_INET, port);
if (xprt != NULL) { if (xprt != NULL) {
svc_close_xprt(xprt); svc_close_xprt(xprt);
svc_xprt_put(xprt); svc_xprt_put(xprt);
...@@ -748,7 +748,7 @@ static ssize_t __write_ports_delxprt(char *buf) ...@@ -748,7 +748,7 @@ static ssize_t __write_ports_delxprt(char *buf)
if (port < 1 || port > USHRT_MAX || nfsd_serv == NULL) if (port < 1 || port > USHRT_MAX || nfsd_serv == NULL)
return -EINVAL; return -EINVAL;
xprt = svc_find_xprt(nfsd_serv, transport, AF_UNSPEC, port); xprt = svc_find_xprt(nfsd_serv, transport, &init_net, AF_UNSPEC, port);
if (xprt == NULL) if (xprt == NULL)
return -ENOTCONN; return -ENOTCONN;
......
...@@ -121,7 +121,8 @@ void svc_close_xprt(struct svc_xprt *xprt); ...@@ -121,7 +121,8 @@ void svc_close_xprt(struct svc_xprt *xprt);
int svc_port_is_privileged(struct sockaddr *sin); int svc_port_is_privileged(struct sockaddr *sin);
int svc_print_xprts(char *buf, int maxlen); int svc_print_xprts(char *buf, int maxlen);
struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
const sa_family_t af, const unsigned short port); struct net *net, const sa_family_t af,
const unsigned short port);
int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen);
static inline void svc_xprt_get(struct svc_xprt *xprt) static inline void svc_xprt_get(struct svc_xprt *xprt)
......
...@@ -1089,6 +1089,7 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt) ...@@ -1089,6 +1089,7 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt)
* svc_find_xprt - find an RPC transport instance * svc_find_xprt - find an RPC transport instance
* @serv: pointer to svc_serv to search * @serv: pointer to svc_serv to search
* @xcl_name: C string containing transport's class name * @xcl_name: C string containing transport's class name
* @net: owner net pointer
* @af: Address family of transport's local address * @af: Address family of transport's local address
* @port: transport's IP port number * @port: transport's IP port number
* *
...@@ -1101,7 +1102,8 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt) ...@@ -1101,7 +1102,8 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt)
* service's list that has a matching class name. * service's list that has a matching class name.
*/ */
struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
const sa_family_t af, const unsigned short port) struct net *net, const sa_family_t af,
const unsigned short port)
{ {
struct svc_xprt *xprt; struct svc_xprt *xprt;
struct svc_xprt *found = NULL; struct svc_xprt *found = NULL;
...@@ -1112,6 +1114,8 @@ struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, ...@@ -1112,6 +1114,8 @@ struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
spin_lock_bh(&serv->sv_lock); spin_lock_bh(&serv->sv_lock);
list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list) { list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list) {
if (xprt->xpt_net != net)
continue;
if (strcmp(xprt->xpt_class->xcl_name, xcl_name)) if (strcmp(xprt->xpt_class->xcl_name, xcl_name))
continue; continue;
if (af != AF_UNSPEC && af != xprt->xpt_local.ss_family) if (af != AF_UNSPEC && af != xprt->xpt_local.ss_family)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment