Commit c34fae00 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: When recovering state fails with EAGAIN, retry the same recovery

If the server returns with EAGAIN when we're trying to recover from
a server reboot, we currently delay for 1 second, but then mark the
stateid as needing recovery after the grace period has expired.

Instead, we should just retry the same recovery process immediately
after the 1 second delay. Break out of the loop after 10 retries.

Fixes: 35a61606 ("NFS: Reduce indentation of the switch statement...")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 86dbd08b
...@@ -1607,6 +1607,7 @@ static int __nfs4_reclaim_open_state(struct nfs4_state_owner *sp, struct nfs4_st ...@@ -1607,6 +1607,7 @@ static int __nfs4_reclaim_open_state(struct nfs4_state_owner *sp, struct nfs4_st
static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs4_state_recovery_ops *ops) static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs4_state_recovery_ops *ops)
{ {
struct nfs4_state *state; struct nfs4_state *state;
unsigned int loop = 0;
int status = 0; int status = 0;
/* Note: we rely on the sp->so_states list being ordered /* Note: we rely on the sp->so_states list being ordered
...@@ -1633,8 +1634,10 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs ...@@ -1633,8 +1634,10 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
switch (status) { switch (status) {
default: default:
if (status >= 0) if (status >= 0) {
loop = 0;
break; break;
}
printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status); printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status);
/* Fall through */ /* Fall through */
case -ENOENT: case -ENOENT:
...@@ -1648,6 +1651,10 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs ...@@ -1648,6 +1651,10 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
break; break;
case -EAGAIN: case -EAGAIN:
ssleep(1); ssleep(1);
if (loop++ < 10) {
set_bit(ops->state_flag_bit, &state->flags);
break;
}
/* Fall through */ /* Fall through */
case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_ADMIN_REVOKED:
case -NFS4ERR_STALE_STATEID: case -NFS4ERR_STALE_STATEID:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment