[pnfs] [PATCH 08/11] nfs41: clean up session_reclaimer error path
andros at netapp.com
andros at netapp.com
Fri Jul 11 10:39:15 EDT 2008
From: Andy Adamson <andros at netapp.com>
Return the nfs4_proc_destroy_session status to the session reclaimer and
check for NFS4ERR_BADSESSION and NFS4ERR_DEADSESSION. Other destroy session
errors should be handled in nfs4_proc_destroy_session where the call can
be retried with adjusted arguments.
NFS4ERR_STALE_STATEID is not a v4.1 error. NFS4ERR_EXPIRED is not returned
by either nfs4_proc_destroy_session or nfs4_proc_create_session.
Don't set/unset the session ref_count since it is not alloc/free.
Signed-off-by: Andy Adamson<andros at netapp.com>
---
fs/nfs/nfs41_session_recovery.c | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/fs/nfs/nfs41_session_recovery.c b/fs/nfs/nfs41_session_recovery.c
index f82f548..09c5f43 100644
--- a/fs/nfs/nfs41_session_recovery.c
+++ b/fs/nfs/nfs41_session_recovery.c
@@ -52,18 +52,6 @@ static int nfs41_start_session_recovery(struct nfs4_session *session)
* Session reset
*/
-static void nfs41_reset_put_session(struct nfs4_session *session)
-{
- if (atomic_dec_and_test(&session->ref_count))
- nfs4_proc_destroy_session(session);
-}
-
-static void nfs41_reset_init_session(struct nfs4_session *session)
-{
- memset(session->sess_id, 0, sizeof(nfs41_sessionid));
- atomic_set(&session->ref_count, 1);
-}
-
int nfs41_wait_session_reset(struct nfs4_session *session)
{
might_sleep();
@@ -106,9 +94,25 @@ static int session_reclaimer(void *arg)
reset = nfs41_test_session_reset(rec->session);
if (reset) {
dprintk("%s Session Reset\n", __func__);
- /* reset is called only when all slots are clear */
- nfs41_reset_put_session(rec->session);
- nfs41_reset_init_session(rec->session);
+ /* Reset is called only when all slots are clear.
+ *
+ * Bail on the reset if destroy session op fails or if
+ * the session ref_count is not 1
+ *
+ * Of course since we are resetting the session,
+ * it's OK if the session is already destroyed
+ * on the server.
+ */
+ ret = nfs4_proc_destroy_session(rec->session);
+ switch (ret) {
+ case 0:
+ case -NFS4ERR_BADSESSION:
+ case -NFS4ERR_DEADSESSION:
+ break;
+ default:
+ goto out_error;
+ }
+ memset(rec->session->sess_id, 0, sizeof(nfs41_sessionid));
}
ret = nfs4_proc_create_session(rec->session, reset);
if (ret)
@@ -135,8 +139,6 @@ out_error:
switch (ret) {
case -NFS4ERR_STALE_CLIENTID:
- case -NFS4ERR_STALE_STATEID:
- case -NFS4ERR_EXPIRED:
set_bit(NFS4CLNT_LEASE_EXPIRED, &rec->session->clp->cl_state);
break;
}
--
1.5.4.1
More information about the pNFS
mailing list