aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4callback.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index fff96dc7704e..69955e98e086 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -613,24 +613,14 @@ void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
613 * If the slot is available, then mark it busy. Otherwise, set the 613 * If the slot is available, then mark it busy. Otherwise, set the
614 * thread for sleeping on the callback RPC wait queue. 614 * thread for sleeping on the callback RPC wait queue.
615 */ 615 */
616static int nfsd41_cb_setup_sequence(struct nfs4_client *clp, 616static bool nfsd41_cb_get_slot(struct nfs4_client *clp, struct rpc_task *task)
617 struct rpc_task *task)
618{ 617{
619 u32 *ptr = (u32 *)clp->cl_cb_session->se_sessionid.data;
620 int status = 0;
621
622 dprintk("%s: %u:%u:%u:%u\n", __func__,
623 ptr[0], ptr[1], ptr[2], ptr[3]);
624
625 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { 618 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
626 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); 619 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL);
627 dprintk("%s slot is busy\n", __func__); 620 dprintk("%s slot is busy\n", __func__);
628 status = -EAGAIN; 621 return false;
629 goto out;
630 } 622 }
631out: 623 return true;
632 dprintk("%s status=%d\n", __func__, status);
633 return status;
634} 624}
635 625
636/* 626/*
@@ -643,19 +633,11 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
643 struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall); 633 struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
644 struct nfs4_client *clp = dp->dl_client; 634 struct nfs4_client *clp = dp->dl_client;
645 u32 minorversion = clp->cl_minorversion; 635 u32 minorversion = clp->cl_minorversion;
646 int status = 0;
647 636
648 cb->cb_minorversion = minorversion; 637 cb->cb_minorversion = minorversion;
649 if (minorversion) { 638 if (minorversion) {
650 status = nfsd41_cb_setup_sequence(clp, task); 639 if (!nfsd41_cb_get_slot(clp, task))
651 if (status) {
652 if (status != -EAGAIN) {
653 /* terminate rpc task */
654 task->tk_status = status;
655 task->tk_action = NULL;
656 }
657 return; 640 return;
658 }
659 } 641 }
660 rpc_call_start(task); 642 rpc_call_start(task);
661} 643}