aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-01 15:19:46 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-05 18:30:49 -0500
commit7b939a3f44293516c4225f640e8c4b9200beeabc (patch)
tree199438b7f5fb5792d72365c06414fde7e515c5d3 /fs/nfs/nfs4proc.c
parentfd0c09537a8494e9dccf3856b90058e1f97f1d62 (diff)
NFSv4.1: Clean up nfs41_setup_sequence
Move all the sleep-and-exit cases into a single section of code. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 4aaaa3ba3088..87525eb60bd8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -523,18 +523,14 @@ int nfs41_setup_sequence(struct nfs4_session *session,
523 if (test_bit(NFS4_SESSION_DRAINING, &session->session_state) && 523 if (test_bit(NFS4_SESSION_DRAINING, &session->session_state) &&
524 !rpc_task_has_priority(task, RPC_PRIORITY_PRIVILEGED)) { 524 !rpc_task_has_priority(task, RPC_PRIORITY_PRIVILEGED)) {
525 /* The state manager will wait until the slot table is empty */ 525 /* The state manager will wait until the slot table is empty */
526 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
527 spin_unlock(&tbl->slot_tbl_lock);
528 dprintk("%s session is draining\n", __func__); 526 dprintk("%s session is draining\n", __func__);
529 return -EAGAIN; 527 goto out_sleep;
530 } 528 }
531 529
532 if (!rpc_queue_empty(&tbl->slot_tbl_waitq) && 530 if (!rpc_queue_empty(&tbl->slot_tbl_waitq) &&
533 !rpc_task_has_priority(task, RPC_PRIORITY_PRIVILEGED)) { 531 !rpc_task_has_priority(task, RPC_PRIORITY_PRIVILEGED)) {
534 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
535 spin_unlock(&tbl->slot_tbl_lock);
536 dprintk("%s enforce FIFO order\n", __func__); 532 dprintk("%s enforce FIFO order\n", __func__);
537 return -EAGAIN; 533 goto out_sleep;
538 } 534 }
539 535
540 slot = nfs4_alloc_slot(tbl); 536 slot = nfs4_alloc_slot(tbl);
@@ -542,10 +538,8 @@ int nfs41_setup_sequence(struct nfs4_session *session,
542 /* If out of memory, try again in 1/4 second */ 538 /* If out of memory, try again in 1/4 second */
543 if (slot == ERR_PTR(-ENOMEM)) 539 if (slot == ERR_PTR(-ENOMEM))
544 task->tk_timeout = HZ >> 2; 540 task->tk_timeout = HZ >> 2;
545 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
546 spin_unlock(&tbl->slot_tbl_lock);
547 dprintk("<-- %s: no free slots\n", __func__); 541 dprintk("<-- %s: no free slots\n", __func__);
548 return -EAGAIN; 542 goto out_sleep;
549 } 543 }
550 spin_unlock(&tbl->slot_tbl_lock); 544 spin_unlock(&tbl->slot_tbl_lock);
551 545
@@ -566,6 +560,10 @@ int nfs41_setup_sequence(struct nfs4_session *session,
566out_success: 560out_success:
567 rpc_call_start(task); 561 rpc_call_start(task);
568 return 0; 562 return 0;
563out_sleep:
564 rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
565 spin_unlock(&tbl->slot_tbl_lock);
566 return -EAGAIN;
569} 567}
570EXPORT_SYMBOL_GPL(nfs41_setup_sequence); 568EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
571 569