aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4client.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4client.c')
-rw-r--r--fs/nfs/nfs4client.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index ffdb28d86cf8..03311259b0c4 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -241,28 +241,25 @@ void nfs4_free_client(struct nfs_client *clp)
241 */ 241 */
242static int nfs4_init_callback(struct nfs_client *clp) 242static int nfs4_init_callback(struct nfs_client *clp)
243{ 243{
244 struct rpc_xprt *xprt;
244 int error; 245 int error;
245 246
246 if (clp->rpc_ops->version == 4) { 247 xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
247 struct rpc_xprt *xprt;
248 248
249 xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); 249 if (nfs4_has_session(clp)) {
250 250 error = xprt_setup_backchannel(xprt, NFS41_BC_MIN_CALLBACKS);
251 if (nfs4_has_session(clp)) { 251 if (error < 0)
252 error = xprt_setup_backchannel(xprt,
253 NFS41_BC_MIN_CALLBACKS);
254 if (error < 0)
255 return error;
256 }
257
258 error = nfs_callback_up(clp->cl_mvops->minor_version, xprt);
259 if (error < 0) {
260 dprintk("%s: failed to start callback. Error = %d\n",
261 __func__, error);
262 return error; 252 return error;
263 }
264 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
265 } 253 }
254
255 error = nfs_callback_up(clp->cl_mvops->minor_version, xprt);
256 if (error < 0) {
257 dprintk("%s: failed to start callback. Error = %d\n",
258 __func__, error);
259 return error;
260 }
261 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
262
266 return 0; 263 return 0;
267} 264}
268 265
@@ -498,8 +495,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
498 atomic_inc(&pos->cl_count); 495 atomic_inc(&pos->cl_count);
499 spin_unlock(&nn->nfs_client_lock); 496 spin_unlock(&nn->nfs_client_lock);
500 497
501 if (prev) 498 nfs_put_client(prev);
502 nfs_put_client(prev);
503 prev = pos; 499 prev = pos;
504 500
505 status = nfs_wait_client_init_complete(pos); 501 status = nfs_wait_client_init_complete(pos);
@@ -517,8 +513,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
517 atomic_inc(&pos->cl_count); 513 atomic_inc(&pos->cl_count);
518 spin_unlock(&nn->nfs_client_lock); 514 spin_unlock(&nn->nfs_client_lock);
519 515
520 if (prev) 516 nfs_put_client(prev);
521 nfs_put_client(prev);
522 prev = pos; 517 prev = pos;
523 518
524 status = nfs4_proc_setclientid_confirm(pos, &clid, cred); 519 status = nfs4_proc_setclientid_confirm(pos, &clid, cred);
@@ -549,8 +544,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
549 544
550 /* No match found. The server lost our clientid */ 545 /* No match found. The server lost our clientid */
551out: 546out:
552 if (prev) 547 nfs_put_client(prev);
553 nfs_put_client(prev);
554 dprintk("NFS: <-- %s status = %d\n", __func__, status); 548 dprintk("NFS: <-- %s status = %d\n", __func__, status);
555 return status; 549 return status;
556} 550}
@@ -641,8 +635,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
641 atomic_inc(&pos->cl_count); 635 atomic_inc(&pos->cl_count);
642 spin_unlock(&nn->nfs_client_lock); 636 spin_unlock(&nn->nfs_client_lock);
643 637
644 if (prev) 638 nfs_put_client(prev);
645 nfs_put_client(prev);
646 prev = pos; 639 prev = pos;
647 640
648 status = nfs_wait_client_init_complete(pos); 641 status = nfs_wait_client_init_complete(pos);
@@ -675,8 +668,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
675 /* No matching nfs_client found. */ 668 /* No matching nfs_client found. */
676 spin_unlock(&nn->nfs_client_lock); 669 spin_unlock(&nn->nfs_client_lock);
677 dprintk("NFS: <-- %s status = %d\n", __func__, status); 670 dprintk("NFS: <-- %s status = %d\n", __func__, status);
678 if (prev) 671 nfs_put_client(prev);
679 nfs_put_client(prev);
680 return status; 672 return status;
681} 673}
682#endif /* CONFIG_NFS_V4_1 */ 674#endif /* CONFIG_NFS_V4_1 */