Skip to contentSkip to conversation

Reclaim State Bug Fixes

PATCH In review Ricardo Labiaga 2 participants 9 messages Dec 5, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Reclaim State Bug Fixes

The following three patches fix a number of problems during state reclaim. They apply to Trond's master branch.

[PATCH 1/3] nfs41: Mark stateids in need of reclaim if state manager gets stale clientid [PATCH 2/3] nfs41: Handle session errors during delegation return
[PATCH 3/3] nfs41: Retry delegation return if it failed with session error

These were tested on top of an old version of Andy's session draining patches.

- ricardo

#1 lore raw

PATCH 1/3 nfs41: Mark stateids in need of reclaim if state manager gets stale clientid

The state manager was not marking the stateids as needing to be reclaimed after reestablishing the clientid.

---
 fs/nfs/nfs4state.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/nfs4state.c +1 -0
index 630199d..ae90df8 100644
@@ -1157,6 +1157,7 @@ static void nfs4_session_recovery_handle_error(struct nfs_client *clp, int err)
 	case -NFS4ERR_STALE_CLIENTID:
 		set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
 		set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state);
+		nfs4_state_start_reclaim_reboot(clp);
 	}
 }
 
Signature · 1 line
1.5.4.3
#2 lore raw

PATCH 2/3 nfs41: Handle session errors during delegation return

Add session error handling to nfs4_open_delegation_recall()

---
 fs/nfs/nfs4proc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +12 -0
index fb94ed0..97d4a82 100644
@@ -1169,6 +1169,18 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state
 			case -ENOENT:
 			case -ESTALE:
 				goto out;
+			case -NFS4ERR_BADSESSION:
+			case -NFS4ERR_BADSLOT:
+			case -NFS4ERR_BAD_HIGH_SLOT:
+			case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
+			case -NFS4ERR_DEADSESSION:
+			case -NFS4ERR_SEQ_FALSE_RETRY:
+			case -NFS4ERR_SEQ_MISORDERED:
+				dprintk("%s ERROR: %d Reset session\n",
+					__func__, err);
+				set_bit(NFS4CLNT_SESSION_SETUP,
+					&server->nfs_client->cl_state);
+				goto out;
 			case -NFS4ERR_STALE_CLIENTID:
 			case -NFS4ERR_STALE_STATEID:
 			case -NFS4ERR_EXPIRED:
Signature · 1 line
1.5.4.3
#3 lore raw

PATCH 3/3 nfs41: Retry delegation return if it failed with session error

Update nfs4_delegreturn_done() to retry the operation after setting the NFS4CLNT_SESSION_SETUP bit to indicate the need to reset the session.

---
 fs/nfs/nfs4proc.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +11 -2
index 97d4a82..25f4180 100644
@@ -3484,9 +3484,18 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
 	nfs4_sequence_done_free_slot(data->res.server, &data->res.seq_res,
 				     task->tk_status);
 
-	data->rpc_status = task->tk_status;
-	if (data->rpc_status == 0)
+	switch (task->tk_status) {
+	case -NFS4ERR_STALE_STATEID:
+	case -NFS4ERR_EXPIRED:
+	case 0:
 		renew_lease(data->res.server, data->timestamp);
+		break;
+	default:
+		if (nfs4_async_handle_error(task, data->res.server, NULL) ==
+				-EAGAIN)
+			nfs4_restart_rpc(task, data->res.server->nfs_client);
+	}
+	data->rpc_status = task->tk_status;
 }
 
 static void nfs4_delegreturn_release(void *calldata)
Signature · 1 line
1.5.4.3
#4 lore raw

Re: [PATCH 3/3] nfs41: Retry delegation return if it failed with session error

Quoted 18 lines · Ricardo Labiaga

Update nfs4_delegreturn_done() to retry the operation after setting the NFS4CLNT_SESSION_SETUP bit to indicate the need to reset the session.

---
 fs/nfs/nfs4proc.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +0 -2
index 97d4a82..25f4180 100644
@@ -3484,9 +3484,18 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
 	nfs4_sequence_done_free_slot(data->res.server, &data->res.seq_res,
 				     task->tk_status);
 
-	data->rpc_status = task->tk_status;
-	if (data->rpc_status == 0)

fs/nfs/nfs4proc.c static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) · line 3496

Quoted 10 lines
fs/nfs/nfs4proc.c +9 -0
+	switch (task->tk_status) {
+	case -NFS4ERR_STALE_STATEID:
+	case -NFS4ERR_EXPIRED:
+	case 0:
 		renew_lease(data->res.server, data->timestamp);
+		break;
+	default:
+		if (nfs4_async_handle_error(task, data->res.server, NULL) ==
+				-EAGAIN)
+			nfs4_restart_rpc(task, data->res.server->nfs_client);

return;

Quoted 5 lines
fs/nfs/nfs4proc.c +2 -0
+	}
+	data->rpc_status = task->tk_status;
 }
 
 static void nfs4_delegreturn_release(void *calldata)
#5 lore raw

Re: [PATCH 2/3] nfs41: Handle session errors during delegation return

In reply to Ricardo Labiaga
Quoted 20 lines · Ricardo Labiaga

Add session error handling to nfs4_open_delegation_recall()

---
 fs/nfs/nfs4proc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +5 -0
index fb94ed0..97d4a82 100644
@@ -1169,6 +1169,18 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state
 			case -ENOENT:
 			case -ESTALE:
 				goto out;
+			case -NFS4ERR_BADSESSION:
+			case -NFS4ERR_BADSLOT:
+			case -NFS4ERR_BAD_HIGH_SLOT:
+			case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
+			case -NFS4ERR_DEADSESSION:

fs/nfs/nfs4proc.c int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state · line 1186

Quoted 10 lines
fs/nfs/nfs4proc.c +7 -0
+			case -NFS4ERR_SEQ_FALSE_RETRY:
+			case -NFS4ERR_SEQ_MISORDERED:
+				dprintk("%s ERROR: %d Reset session\n",
+					__func__, err);
+				set_bit(NFS4CLNT_SESSION_SETUP,
+					&server->nfs_client->cl_state);
+				goto out;
 			case -NFS4ERR_STALE_CLIENTID:
 			case -NFS4ERR_STALE_STATEID:
 			case -NFS4ERR_EXPIRED:

BADSESSION and DEADSESSION should call nfs4_schedule_state_recovery() instead.

The rest can continue to call NFS4CLNT_SESSION_RESET, but should also call nfs4_schedule_state_manager().

Trond

#6 lore raw

Re: [PATCH 2/3] nfs41: Handle session errors during delegation return

Quoted 27 lines · Trond Myklebust
Quoted 26 lines · Ricardo Labiaga

Add session error handling to nfs4_open_delegation_recall()

---
 fs/nfs/nfs4proc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +0 -0
index fb94ed0..97d4a82 100644
@@ -1169,6 +1169,18 @@ int nfs4_open_delegation_recall(struct

nfs_open_context *ctx, struct nfs4_state
case -ENOENT:
case -ESTALE:
goto out;

fs/nfs/nfs4proc.c +10 -0
+   case -NFS4ERR_BADSESSION:
+   case -NFS4ERR_BADSLOT:
+   case -NFS4ERR_BAD_HIGH_SLOT:
+   case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
+   case -NFS4ERR_DEADSESSION:
+   case -NFS4ERR_SEQ_FALSE_RETRY:
+   case -NFS4ERR_SEQ_MISORDERED:
+    dprintk("%s ERROR: %d Reset session\n",
+     __func__, err);
+    set_bit(NFS4CLNT_SESSION_SETUP,
Quoted 9 lines
Quoted 5 lines
fs/nfs/nfs4proc.c +2 -0
+     &server->nfs_client->cl_state);
+    goto out;

case -NFS4ERR_STALE_CLIENTID:
case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_EXPIRED:

BADSESSION and DEADSESSION should call nfs4_schedule_state_recovery() instead.

Will do. I did earlier because I was still based on the master branch.

Quoted 2 lines

The rest can continue to call NFS4CLNT_SESSION_RESET, but should also call nfs4_schedule_state_manager().

The other error handlers (nfs4_handle_exception, ...) call nfs4_schedule_state_recovery() instead of setting NFS4CLNT_SESSION_RESET. Should all of them be changed as well? Not sure I understand the difference in the handling.

- ricardo

Quoted 2 lines

Trond

#7 lore raw

Re: [PATCH 1/3] nfs41: Mark stateids in need of reclaim if state manager gets stale clientid

In reply to Ricardo Labiaga
Quoted 13 lines · Ricardo Labiaga

The state manager was not marking the stateids as needing to be reclaimed after reestablishing the clientid.

---
 fs/nfs/nfs4state.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/nfs4state.c +0 -0
index 630199d..ae90df8 100644

fs/nfs/nfs4state.c static void nfs4_session_recovery_handle_error(struct nfs_client *clp, int err) · line 1163

Quoted 7 lines
fs/nfs/nfs4state.c +1 -0
@@ -1157,6 +1157,7 @@ static void nfs4_session_recovery_handle_error(struct nfs_client *clp, int err)
 	case -NFS4ERR_STALE_CLIENTID:
 		set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
 		set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state);
+		nfs4_state_start_reclaim_reboot(clp);
 	}
 }
 

So, why do we need a special nfs4_session_recovery_handle_error() that just mirrors the existing nfs4_recovery_handle_error().

Please just get rid of it...

Trond

#8 lore raw

Re: [PATCH 1/3] nfs41: Mark stateids in need of reclaim if state manager gets stale clientid

Quoted 9 lines · Trond Myklebust
Quoted 8 lines · Ricardo Labiaga

The state manager was not marking the stateids as needing to be reclaimed after reestablishing the clientid.

---
 fs/nfs/nfs4state.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 17 lines
Quoted 6 lines
fs/nfs/nfs4state.c +0 -0
index 630199d..ae90df8 100644
@@ -1157,6 +1157,7 @@ static void nfs4_session_recovery_handle_error(struct
 nfs_client *clp, int err)
Quoted 7 lines

case -NFS4ERR_STALE_CLIENTID:
set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
set_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state);
+ nfs4_state_start_reclaim_reboot(clp);
}
}

So, why do we need a special nfs4_session_recovery_handle_error() that just mirrors the existing nfs4_recovery_handle_error().

Good point. The early exit from nfs4_state_end_reclaim_reboot() if NFS4CLNT_RECLAIM_REBOOT is set makes it equivalent. I'll make the change.

- ricardo

Quoted 3 lines

Please just get rid of it...

Trond