diff options
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index d6c46a9de422..ea77aa63754a 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -457,9 +457,8 @@ static int max_cb_time(void) | |||
457 | /* Reference counting, callback cleanup, etc., all look racy as heck. | 457 | /* Reference counting, callback cleanup, etc., all look racy as heck. |
458 | * And why is cl_cb_set an atomic? */ | 458 | * And why is cl_cb_set an atomic? */ |
459 | 459 | ||
460 | int setup_callback_client(struct nfs4_client *clp) | 460 | int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *cb) |
461 | { | 461 | { |
462 | struct nfs4_cb_conn *cb = &clp->cl_cb_conn; | ||
463 | struct rpc_timeout timeparms = { | 462 | struct rpc_timeout timeparms = { |
464 | .to_initval = max_cb_time(), | 463 | .to_initval = max_cb_time(), |
465 | .to_retries = 0, | 464 | .to_retries = 0, |
@@ -481,7 +480,7 @@ int setup_callback_client(struct nfs4_client *clp) | |||
481 | if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) | 480 | if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) |
482 | return -EINVAL; | 481 | return -EINVAL; |
483 | if (cb->cb_minorversion) { | 482 | if (cb->cb_minorversion) { |
484 | args.bc_xprt = clp->cl_cb_conn.cb_xprt; | 483 | args.bc_xprt = cb->cb_xprt; |
485 | args.protocol = XPRT_TRANSPORT_BC_TCP; | 484 | args.protocol = XPRT_TRANSPORT_BC_TCP; |
486 | } | 485 | } |
487 | /* Create RPC client */ | 486 | /* Create RPC client */ |
@@ -491,7 +490,7 @@ int setup_callback_client(struct nfs4_client *clp) | |||
491 | PTR_ERR(client)); | 490 | PTR_ERR(client)); |
492 | return PTR_ERR(client); | 491 | return PTR_ERR(client); |
493 | } | 492 | } |
494 | clp->cl_cb_client = client; | 493 | nfsd4_set_callback_client(clp, client); |
495 | return 0; | 494 | return 0; |
496 | 495 | ||
497 | } | 496 | } |
@@ -548,14 +547,13 @@ void do_probe_callback(struct nfs4_client *clp) | |||
548 | /* | 547 | /* |
549 | * Set up the callback client and put a NFSPROC4_CB_NULL on the wire... | 548 | * Set up the callback client and put a NFSPROC4_CB_NULL on the wire... |
550 | */ | 549 | */ |
551 | void | 550 | void nfsd4_probe_callback(struct nfs4_client *clp, struct nfs4_cb_conn *cb) |
552 | nfsd4_probe_callback(struct nfs4_client *clp) | ||
553 | { | 551 | { |
554 | int status; | 552 | int status; |
555 | 553 | ||
556 | BUG_ON(atomic_read(&clp->cl_cb_set)); | 554 | BUG_ON(atomic_read(&clp->cl_cb_set)); |
557 | 555 | ||
558 | status = setup_callback_client(clp); | 556 | status = setup_callback_client(clp, cb); |
559 | if (status) { | 557 | if (status) { |
560 | warn_no_callback_path(clp, status); | 558 | warn_no_callback_path(clp, status); |
561 | return; | 559 | return; |
@@ -645,18 +643,32 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata) | |||
645 | } | 643 | } |
646 | } | 644 | } |
647 | 645 | ||
646 | |||
648 | static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) | 647 | static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) |
649 | { | 648 | { |
650 | struct nfs4_delegation *dp = calldata; | 649 | struct nfs4_delegation *dp = calldata; |
651 | struct nfs4_client *clp = dp->dl_client; | 650 | struct nfs4_client *clp = dp->dl_client; |
651 | struct rpc_clnt *current_rpc_client = clp->cl_cb_client; | ||
652 | 652 | ||
653 | nfsd4_cb_done(task, calldata); | 653 | nfsd4_cb_done(task, calldata); |
654 | 654 | ||
655 | if (current_rpc_client == NULL) { | ||
656 | /* We're shutting down; give up. */ | ||
657 | /* XXX: err, or is it ok just to fall through | ||
658 | * and rpc_restart_call? */ | ||
659 | return; | ||
660 | } | ||
661 | |||
655 | switch (task->tk_status) { | 662 | switch (task->tk_status) { |
656 | case -EIO: | 663 | case -EIO: |
657 | /* Network partition? */ | 664 | /* Network partition? */ |
658 | atomic_set(&clp->cl_cb_set, 0); | 665 | atomic_set(&clp->cl_cb_set, 0); |
659 | warn_no_callback_path(clp, task->tk_status); | 666 | warn_no_callback_path(clp, task->tk_status); |
667 | if (current_rpc_client != task->tk_client) { | ||
668 | /* queue a callback on the new connection: */ | ||
669 | nfsd4_cb_recall(dp); | ||
670 | return; | ||
671 | } | ||
660 | case -EBADHANDLE: | 672 | case -EBADHANDLE: |
661 | case -NFS4ERR_BAD_STATEID: | 673 | case -NFS4ERR_BAD_STATEID: |
662 | /* Race: client probably got cb_recall | 674 | /* Race: client probably got cb_recall |
@@ -705,8 +717,7 @@ void nfsd4_destroy_callback_queue(void) | |||
705 | destroy_workqueue(callback_wq); | 717 | destroy_workqueue(callback_wq); |
706 | } | 718 | } |
707 | 719 | ||
708 | void nfsd4_set_callback_client(struct nfs4_client *clp, struct rpc_clnt | 720 | void nfsd4_set_callback_client(struct nfs4_client *clp, struct rpc_clnt *new) |
709 | *new) | ||
710 | { | 721 | { |
711 | struct rpc_clnt *old = clp->cl_cb_client; | 722 | struct rpc_clnt *old = clp->cl_cb_client; |
712 | 723 | ||