Commit 7ebeb7fe authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFSv4: If recovery failed for a specific open stateid, then don't retry

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Tested-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 76e8a1bd
...@@ -991,6 +991,8 @@ int nfs4_select_rw_stateid(struct nfs4_state *state, ...@@ -991,6 +991,8 @@ int nfs4_select_rw_stateid(struct nfs4_state *state,
{ {
int ret; int ret;
if (!nfs4_valid_open_stateid(state))
return -EIO;
if (cred != NULL) if (cred != NULL)
*cred = NULL; *cred = NULL;
ret = nfs4_copy_lock_stateid(dst, state, lockowner); ret = nfs4_copy_lock_stateid(dst, state, lockowner);
...@@ -1303,6 +1305,8 @@ void nfs4_schedule_path_down_recovery(struct nfs_client *clp) ...@@ -1303,6 +1305,8 @@ void nfs4_schedule_path_down_recovery(struct nfs_client *clp)
static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
{ {
if (!nfs4_valid_open_stateid(state))
return 0;
set_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); set_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
/* Don't recover state that expired before the reboot */ /* Don't recover state that expired before the reboot */
if (test_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags)) { if (test_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags)) {
...@@ -1316,6 +1320,8 @@ static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_st ...@@ -1316,6 +1320,8 @@ static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_st
int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state) int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state)
{ {
if (!nfs4_valid_open_stateid(state))
return 0;
set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags); set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags);
clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
set_bit(NFS_OWNER_RECLAIM_NOGRACE, &state->owner->so_flags); set_bit(NFS_OWNER_RECLAIM_NOGRACE, &state->owner->so_flags);
...@@ -1327,9 +1333,8 @@ int nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4_ ...@@ -1327,9 +1333,8 @@ int nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4_
{ {
struct nfs_client *clp = server->nfs_client; struct nfs_client *clp = server->nfs_client;
if (!nfs4_valid_open_stateid(state)) if (!nfs4_state_mark_reclaim_nograce(clp, state))
return -EBADF; return -EBADF;
nfs4_state_mark_reclaim_nograce(clp, state);
dprintk("%s: scheduling stateid recovery for server %s\n", __func__, dprintk("%s: scheduling stateid recovery for server %s\n", __func__,
clp->cl_hostname); clp->cl_hostname);
nfs4_schedule_state_manager(clp); nfs4_schedule_state_manager(clp);
...@@ -1380,15 +1385,14 @@ void nfs_inode_find_state_and_recover(struct inode *inode, ...@@ -1380,15 +1385,14 @@ void nfs_inode_find_state_and_recover(struct inode *inode,
state = ctx->state; state = ctx->state;
if (state == NULL) if (state == NULL)
continue; continue;
if (nfs4_stateid_match_other(&state->stateid, stateid)) { if (nfs4_stateid_match_other(&state->stateid, stateid) &&
nfs4_state_mark_reclaim_nograce(clp, state); nfs4_state_mark_reclaim_nograce(clp, state)) {
found = true; found = true;
continue; continue;
} }
if (nfs_state_lock_state_matches_stateid(state, stateid)) { if (nfs_state_lock_state_matches_stateid(state, stateid) &&
nfs4_state_mark_reclaim_nograce(clp, state); nfs4_state_mark_reclaim_nograce(clp, state))
found = true; found = true;
}
} }
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
......
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