public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Subject: [PATCH 2/2] nfs41: Don't clear DRAINING flag on NFS4ERR_STALE_CLIENTID
Date: Sun,  6 Dec 2009 03:16:24 -0800	[thread overview]
Message-ID: <1260098184-19209-3-git-send-email-Ricardo.Labiaga@netapp.com> (raw)
In-Reply-To: <1260098184-19209-2-git-send-email-Ricardo.Labiaga@netapp.com>

If CREATE_SESSION fails with NFS4ERR_STALE_CLIENTID, don't clear the
NFS4CLNT_SESSION_DRAINING flag and don't wake RPCs waiting for the
session to be reestablished.  We don't have a session yet, so there
is no reason to wake other RPCs.

This avoids sending spurious compounds with bogus sequenceID during
session and state recovery.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
---
 fs/nfs/nfs4state.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index d236257..94c238d 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1250,7 +1250,7 @@ static int nfs4_reset_session(struct nfs_client *clp)
 		spin_unlock(&tbl->slot_tbl_lock);
 		status = wait_for_completion_interruptible(&ses->complete);
 		if (status) /* -ERESTARTSYS */
-			goto out;
+			goto out_wake;
 	} else {
 		spin_unlock(&tbl->slot_tbl_lock);
 	}
@@ -1259,18 +1259,26 @@ static int nfs4_reset_session(struct nfs_client *clp)
 	if (status && status != -NFS4ERR_BADSESSION &&
 	    status != -NFS4ERR_DEADSESSION) {
 		nfs4_session_recovery_handle_error(clp, status);
-		goto out;
+		goto out_wake;
 	}
 
 	memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN);
 	status = nfs4_proc_create_session(clp);
-	if (status)
+	if (status) {
 		nfs4_session_recovery_handle_error(clp, status);
-		/* fall through*/
-out:
-	/* Wake up the next rpc task even on error */
+		if (status == -NFS4ERR_STALE_CLIENTID) {
+			/*
+			 * Let the state manager reestablish state
+			 * without waking other yet.
+			 */
+			goto out;
+		}
+	}
+out_wake:
+	/* Wake up the next rpc task */
 	clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
 	rpc_wake_up(&clp->cl_session->fc_slot_table.slot_tbl_waitq);
+out:
 	if (status == 0)
 		nfs41_setup_state_renewal(clp);
 	return status;
@@ -1337,6 +1345,8 @@ static void nfs4_state_manager(struct nfs_client *clp)
 			status = nfs4_reset_session(clp);
 			if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
 				continue;
+			if (status == -NFS4ERR_STALE_CLIENTID)
+				continue;
 			if (status < 0)
 				goto out_error;
 		}
-- 
1.5.4.3


  reply	other threads:[~2009-12-06 11:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06 11:16 [PATCH 0/2] Bugfixes for zero stateID RPCs Ricardo Labiaga
2009-12-06 11:16 ` [PATCH 1/2] nfs41: nfs41_setup_state_renewal Ricardo Labiaga
2009-12-06 11:16   ` Ricardo Labiaga [this message]
2009-12-06 17:05     ` [PATCH 2/2] nfs41: Don't clear DRAINING flag on NFS4ERR_STALE_CLIENTID Trond Myklebust
2009-12-06 18:02     ` Trond Myklebust
2009-12-07  8:13       ` Labiaga, Ricardo
2009-12-06 18:02   ` [PATCH 1/2] nfs41: nfs41_setup_state_renewal Trond Myklebust
2009-12-07  8:12     ` Labiaga, Ricardo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260098184-19209-3-git-send-email-Ricardo.Labiaga@netapp.com \
    --to=ricardo.labiaga@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox