diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-05-02 08:08:38 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-05-31 20:29:39 -0400 |
commit | 9793f7c88937e7ac07305ab1af1a519225836823 (patch) | |
tree | 48a4283a15cb0d5a427e722075fe546cc8cdcc53 /fs/nfs/callback.c | |
parent | c52226daf553b21891f39777d78a54ea4e7e8654 (diff) |
SUNRPC: new svc_bind() routine introduced
This new routine is responsible for service registration in a specified
network context.
The idea is to separate service creation from per-net operations.
Note also: since registering service with svc_bind() can fail, the
service will be destroyed and during destruction it will try to
unregister itself from rpcbind. In this case unregistration has to be
skipped.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfs/callback.c')
-rw-r--r-- | fs/nfs/callback.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index eb95f5091c1a..26b38fb8102e 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kthread.h> | 17 | #include <linux/kthread.h> |
18 | #include <linux/sunrpc/svcauth_gss.h> | 18 | #include <linux/sunrpc/svcauth_gss.h> |
19 | #include <linux/sunrpc/bc_xprt.h> | 19 | #include <linux/sunrpc/bc_xprt.h> |
20 | #include <linux/nsproxy.h> | ||
20 | 21 | ||
21 | #include <net/inet_sock.h> | 22 | #include <net/inet_sock.h> |
22 | 23 | ||
@@ -253,6 +254,7 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt) | |||
253 | char svc_name[12]; | 254 | char svc_name[12]; |
254 | int ret = 0; | 255 | int ret = 0; |
255 | int minorversion_setup; | 256 | int minorversion_setup; |
257 | struct net *net = current->nsproxy->net_ns; | ||
256 | 258 | ||
257 | mutex_lock(&nfs_callback_mutex); | 259 | mutex_lock(&nfs_callback_mutex); |
258 | if (cb_info->users++ || cb_info->task != NULL) { | 260 | if (cb_info->users++ || cb_info->task != NULL) { |
@@ -265,6 +267,12 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt) | |||
265 | goto out_err; | 267 | goto out_err; |
266 | } | 268 | } |
267 | 269 | ||
270 | ret = svc_bind(serv, net); | ||
271 | if (ret < 0) { | ||
272 | printk(KERN_WARNING "NFS: bind callback service failed\n"); | ||
273 | goto out_err; | ||
274 | } | ||
275 | |||
268 | minorversion_setup = nfs_minorversion_callback_svc_setup(minorversion, | 276 | minorversion_setup = nfs_minorversion_callback_svc_setup(minorversion, |
269 | serv, xprt, &rqstp, &callback_svc); | 277 | serv, xprt, &rqstp, &callback_svc); |
270 | if (!minorversion_setup) { | 278 | if (!minorversion_setup) { |