[pnfs] [PATCH] [SQUASHME] nfs41: get rid of session ref_count

Benny Halevy bhalevy at panasas.com
Sun Jul 13 07:51:09 EDT 2008


Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/nfs41_session_recovery.c |    3 +--
 fs/nfs/nfs4proc.c               |   10 +++-------
 include/linux/nfs4_session.h    |    1 -
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/nfs41_session_recovery.c b/fs/nfs/nfs41_session_recovery.c
index 09c5f43..4aa79cc 100644
--- a/fs/nfs/nfs41_session_recovery.c
+++ b/fs/nfs/nfs41_session_recovery.c
@@ -96,8 +96,7 @@ static int session_reclaimer(void *arg)
 		dprintk("%s Session Reset\n", __func__);
 		/* 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
+		 * Bail on the reset if destroy session op fails.
 		 *
 		 * Of course since we are resetting the session,
 		 * it's OK if the session is already destroyed
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7e3661e..c9e0f22 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4620,8 +4620,6 @@ struct nfs4_session *nfs4_alloc_session(void)
 
 	nfs41_set_session_alloc(session);
 
-	atomic_set(&session->ref_count, 1);
-
 	nfs4_init_channel(&session->fore_channel);
 	return session;
 }
@@ -4635,11 +4633,9 @@ static void nfs4_free_session(struct nfs4_session *session)
 void nfs4_put_session(struct nfs4_session **session)
 {
 	dprintk("--> nfs4_put_session()\n");
-	if (atomic_dec_and_test(&((*session)->ref_count))) {
-		nfs4_destroy_slot_table(&((*session)->fore_channel));
-		nfs4_free_session(*session);
-		*session = NULL;
-	}
+	nfs4_destroy_slot_table(&((*session)->fore_channel));
+	nfs4_free_session(*session);
+	*session = NULL;
 	dprintk("<-- nfs4_put_session()\n");
 }
 
diff --git a/include/linux/nfs4_session.h b/include/linux/nfs4_session.h
index 551eb61..6245ffc 100644
--- a/include/linux/nfs4_session.h
+++ b/include/linux/nfs4_session.h
@@ -57,7 +57,6 @@ struct nfs4_session {
 	struct nfs4_channel		fore_channel;
 	struct nfs4_channel		back_channel;
 
-	atomic_t			ref_count;
 	struct rpc_clnt			*clnt;
 	struct nfs_client		*clp;
 };
-- 
1.5.6.2



More information about the pNFS mailing list