aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-08-29 20:03:50 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-09-19 13:08:36 -0400
commit3b01c11ee8bfa9d5d14b028e9fbe861a0f22d328 (patch)
treee524d4d11cdded8f72b12ed6b17d7c657762f5a9 /fs/nfs
parentd00252688604edfd07d0e11a05d3a2b7cf05bb3d (diff)
NFSv4.x: Fix up the global tracking of the callback server
Ensure that the nfs_callback_info[] array correctly tracks the struct svc_serv. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 08e16f9b3333..b125f02ddf8b 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -201,7 +201,6 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
201 201
202 svc_sock_update_bufs(serv); 202 svc_sock_update_bufs(serv);
203 203
204 cb_info->serv = serv;
205 cb_info->rqst = rqstp; 204 cb_info->rqst = rqstp;
206 cb_info->task = kthread_create(serv->sv_ops->svo_function, 205 cb_info->task = kthread_create(serv->sv_ops->svo_function,
207 cb_info->rqst, 206 cb_info->rqst,
@@ -300,7 +299,7 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
300 /* 299 /*
301 * Check whether we're already up and running. 300 * Check whether we're already up and running.
302 */ 301 */
303 if (cb_info->task) { 302 if (cb_info->serv) {
304 /* 303 /*
305 * Note: increase service usage, because later in case of error 304 * Note: increase service usage, because later in case of error
306 * svc_destroy() will be called. 305 * svc_destroy() will be called.
@@ -333,6 +332,7 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
333 printk(KERN_ERR "nfs_callback_create_svc: create service failed\n"); 332 printk(KERN_ERR "nfs_callback_create_svc: create service failed\n");
334 return ERR_PTR(-ENOMEM); 333 return ERR_PTR(-ENOMEM);
335 } 334 }
335 cb_info->serv = serv;
336 /* As there is only one thread we need to over-ride the 336 /* As there is only one thread we need to over-ride the
337 * default maximum of 80 connections 337 * default maximum of 80 connections
338 */ 338 */
@@ -375,6 +375,8 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
375 * thread exits. 375 * thread exits.
376 */ 376 */
377err_net: 377err_net:
378 if (!cb_info->users)
379 cb_info->serv = NULL;
378 svc_destroy(serv); 380 svc_destroy(serv);
379err_create: 381err_create:
380 mutex_unlock(&nfs_callback_mutex); 382 mutex_unlock(&nfs_callback_mutex);
@@ -396,9 +398,11 @@ void nfs_callback_down(int minorversion, struct net *net)
396 mutex_lock(&nfs_callback_mutex); 398 mutex_lock(&nfs_callback_mutex);
397 nfs_callback_down_net(minorversion, cb_info->serv, net); 399 nfs_callback_down_net(minorversion, cb_info->serv, net);
398 cb_info->users--; 400 cb_info->users--;
399 if (cb_info->users == 0 && cb_info->task != NULL) { 401 if (cb_info->users == 0) {
400 kthread_stop(cb_info->task); 402 if (cb_info->task != NULL) {
401 dprintk("nfs_callback_down: service stopped\n"); 403 kthread_stop(cb_info->task);
404 dprintk("nfs_callback_down: service stopped\n");
405 }
402 svc_exit_thread(cb_info->rqst); 406 svc_exit_thread(cb_info->rqst);
403 dprintk("nfs_callback_down: service destroyed\n"); 407 dprintk("nfs_callback_down: service destroyed\n");
404 cb_info->serv = NULL; 408 cb_info->serv = NULL;