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 4/5] nfs41: New NFS4CLNT_RECLAIM_COMPLETE_PENDING state
Date: Mon,  7 Dec 2009 00:21:50 -0800	[thread overview]
Message-ID: <1260174111-23160-5-git-send-email-Ricardo.Labiaga@netapp.com> (raw)
In-Reply-To: <1260174111-23160-4-git-send-email-Ricardo.Labiaga@netapp.com>

nfs4_state_end_reclaim_reboot() can also be invoked as a
result of error processing, so it is not a safe place to
invoke RECLAIM_COMPLETE.  Instead, create a new state
flag that tracks the fact that a RECLAIM_COMPLETE needs
to be issued when all state has been reclaimed, or when
we're done establishing the session for the first time.

If an error occurs in the main state manager loop, just clear the
flag.  No sense in checking if the flag is set in order to clear it.
We're not going to issue the RECLAIM_COMPLETE since there's a high
probability that we had some kind of communication or session problem
which is s how we ended up in the error case.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
---
 fs/nfs/nfs4_fs.h   |    1 +
 fs/nfs/nfs4state.c |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 19f04cc..9962e28 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -46,6 +46,7 @@ enum nfs4_client_state {
 	NFS4CLNT_DELEGRETURN,
 	NFS4CLNT_SESSION_RESET,
 	NFS4CLNT_SESSION_DRAINING,
+	NFS4CLNT_RECLAIM_COMPLETE_PENDING,
 };
 
 /*
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index d741ec6..3bb43df 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1096,9 +1096,6 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
 	struct rb_node *pos;
 	struct nfs4_state *state;
 
-	nfs4_reclaim_complete(clp,
-		nfs4_reboot_recovery_ops[clp->cl_minorversion]);
-
 	if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
 		return;
 
@@ -1335,6 +1332,8 @@ static void nfs4_state_manager(struct nfs_client *clp)
 				goto out_error;
 			}
 			clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
+			set_bit(NFS4CLNT_RECLAIM_COMPLETE_PENDING,
+				&clp->cl_state);
 		}
 
 		if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
@@ -1386,6 +1385,12 @@ static void nfs4_state_manager(struct nfs_client *clp)
 			continue;
 		}
 
+		if (test_and_clear_bit(NFS4CLNT_RECLAIM_COMPLETE_PENDING,
+				&clp->cl_state)) {
+			nfs4_reclaim_complete(clp,
+				nfs4_reboot_recovery_ops[clp->cl_minorversion]);
+		}
+
 		nfs4_clear_state_manager_bit(clp);
 		/* Did we race with an attempt to give us more work? */
 		if (clp->cl_state == 0)
@@ -1397,6 +1402,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
 out_error:
 	printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s"
 			" with error %d\n", clp->cl_hostname, -status);
+	clear_bit(NFS4CLNT_RECLAIM_COMPLETE_PENDING, &clp->cl_state);
 	nfs4_clear_state_manager_bit(clp);
 }
 
-- 
1.5.4.3


  reply	other threads:[~2009-12-07  8:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07  8:21 [PATCH 0/5] Reclaim Stage Bug Fixes Version 2 Ricardo Labiaga
2009-12-07  8:21 ` [PATCH 1/5] nfs41: Mark stateids in need of reclaim if state manager gets stale clientid Ricardo Labiaga
2009-12-07  8:21   ` [PATCH 2/5] nfs41: Handle session errors during delegation return Ricardo Labiaga
2009-12-07  8:21     ` [PATCH 3/5] nfs41: Retry delegation return if it failed with session error Ricardo Labiaga
2009-12-07  8:21       ` Ricardo Labiaga [this message]
2009-12-07  8:21         ` [PATCH 5/5] nfs41: Handle NFSv4.1 session errors in the delegation recall code Ricardo Labiaga
2009-12-07 14:47         ` [PATCH 4/5] nfs41: New NFS4CLNT_RECLAIM_COMPLETE_PENDING state Trond Myklebust
2009-12-07 17:51           ` Labiaga, Ricardo
2009-12-07 18:11             ` Trond Myklebust
2009-12-07 21:41               ` 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=1260174111-23160-5-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