Merge branches 'pm-sleep', 'pm-domains', 'powercap' and 'pm-tools'
[linux-2.6-microblaze.git] / fs / nfs / nfs4proc.c
index e32717f..8963062 100644 (file)
@@ -414,7 +414,7 @@ static int nfs4_delay_interruptible(long *timeout)
 {
        might_sleep();
 
-       freezable_schedule_timeout_interruptible(nfs4_update_delay(timeout));
+       freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
        if (!signal_pending(current))
                return 0;
        return __fatal_signal_pending(current) ? -EINTR :-ERESTARTSYS;
@@ -774,6 +774,14 @@ static void nfs4_slot_sequence_acked(struct nfs4_slot *slot,
        slot->seq_nr_last_acked = seqnr;
 }
 
+static void nfs4_probe_sequence(struct nfs_client *client, const struct cred *cred,
+                               struct nfs4_slot *slot)
+{
+       struct rpc_task *task = _nfs41_proc_sequence(client, cred, slot, true);
+       if (!IS_ERR(task))
+               rpc_put_task_async(task);
+}
+
 static int nfs41_sequence_process(struct rpc_task *task,
                struct nfs4_sequence_res *res)
 {
@@ -790,6 +798,7 @@ static int nfs41_sequence_process(struct rpc_task *task,
                goto out;
 
        session = slot->table->session;
+       clp = session->clp;
 
        trace_nfs4_sequence_done(session, res);
 
@@ -804,7 +813,6 @@ static int nfs41_sequence_process(struct rpc_task *task,
                nfs4_slot_sequence_acked(slot, slot->seq_nr);
                /* Update the slot's sequence and clientid lease timer */
                slot->seq_done = 1;
-               clp = session->clp;
                do_renew_lease(clp, res->sr_timestamp);
                /* Check sequence flags */
                nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags,
@@ -852,10 +860,18 @@ static int nfs41_sequence_process(struct rpc_task *task,
                /*
                 * Were one or more calls using this slot interrupted?
                 * If the server never received the request, then our
-                * transmitted slot sequence number may be too high.
+                * transmitted slot sequence number may be too high. However,
+                * if the server did receive the request then it might
+                * accidentally give us a reply with a mismatched operation.
+                * We can sort this out by sending a lone sequence operation
+                * to the server on the same slot.
                 */
                if ((s32)(slot->seq_nr - slot->seq_nr_last_acked) > 1) {
                        slot->seq_nr--;
+                       if (task->tk_msg.rpc_proc != &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE]) {
+                               nfs4_probe_sequence(clp, task->tk_msg.rpc_cred, slot);
+                               res->sr_slot = NULL;
+                       }
                        goto retry_nowait;
                }
                /*