diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-07-22 09:54:29 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-29 08:30:12 +0200 |
commit | 5ebc4cb0531545d87d3163377549bcef86f552d0 (patch) | |
tree | 261a06d7ec788280ce49481f77756687b33d06bf /fs/nfs | |
parent | 8c0391db53efffb30913c06367f1b3793fc3ba18 (diff) | |
download | linux-stable-5ebc4cb0531545d87d3163377549bcef86f552d0.tar.gz linux-stable-5ebc4cb0531545d87d3163377549bcef86f552d0.tar.bz2 linux-stable-5ebc4cb0531545d87d3163377549bcef86f552d0.zip |
NFSv4: When recovering state fails with EAGAIN, retry the same recovery
[ Upstream commit c34fae003c79570b6c930b425fea3f0b7b1e7056 ]
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: 35a61606a612 ("NFS: Reduce indentation of the switch statement...")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4state.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index e2e3c4f04d3e..556ec916846f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1606,6 +1606,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) { struct nfs4_state *state; + unsigned int loop = 0; int status = 0; /* Note: we rely on the sp->so_states list being ordered @@ -1632,8 +1633,10 @@ restart: switch (status) { default: - if (status >= 0) + if (status >= 0) { + loop = 0; break; + } printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status); /* Fall through */ case -ENOENT: @@ -1647,6 +1650,10 @@ restart: break; case -EAGAIN: ssleep(1); + if (loop++ < 10) { + set_bit(ops->state_flag_bit, &state->flags); + break; + } /* Fall through */ case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_STALE_STATEID: |