]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
NFSv4.1: Clean up nfs41_setup_sequence
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 1 Nov 2012 19:19:46 +0000 (15:19 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 4 Nov 2012 19:43:43 +0000 (14:43 -0500)
Move all the sleep-and-exit cases into a single section of code.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c

index c2a0805e5bf4d98362842d8a87fea84b3fbe7fca..45dc7dbf9009ae90f01e24f04779ea1ef3274a80 100644 (file)
@@ -612,26 +612,20 @@ int nfs41_setup_sequence(struct nfs4_session *session,
        if (test_bit(NFS4_SESSION_DRAINING, &session->session_state) &&
            !rpc_task_has_priority(task, RPC_PRIORITY_PRIVILEGED)) {
                /* The state manager will wait until the slot table is empty */
-               rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
-               spin_unlock(&tbl->slot_tbl_lock);
                dprintk("%s session is draining\n", __func__);
-               return -EAGAIN;
+               goto out_sleep;
        }
 
        if (!rpc_queue_empty(&tbl->slot_tbl_waitq) &&
            !rpc_task_has_priority(task, RPC_PRIORITY_PRIVILEGED)) {
-               rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
-               spin_unlock(&tbl->slot_tbl_lock);
                dprintk("%s enforce FIFO order\n", __func__);
-               return -EAGAIN;
+               goto out_sleep;
        }
 
        slotid = nfs4_find_slot(tbl);
        if (slotid == NFS4_NO_SLOT) {
-               rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
-               spin_unlock(&tbl->slot_tbl_lock);
                dprintk("<-- %s: no free slots\n", __func__);
-               return -EAGAIN;
+               goto out_sleep;
        }
        spin_unlock(&tbl->slot_tbl_lock);
 
@@ -654,6 +648,10 @@ int nfs41_setup_sequence(struct nfs4_session *session,
 out_success:
        rpc_call_start(task);
        return 0;
+out_sleep:
+       rpc_sleep_on(&tbl->slot_tbl_waitq, task, NULL);
+       spin_unlock(&tbl->slot_tbl_lock);
+       return -EAGAIN;
 }
 EXPORT_SYMBOL_GPL(nfs41_setup_sequence);