Commit 43912bbb authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFSv4.1: Allow test_stateid to handle session errors without waiting

If the server crashes while we're testing stateids for validity, then
we want to initiate session recovery. Usually, we will be calling from
a state manager thread, though, so we don't really want to wait.
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 4c8e5447
...@@ -8797,6 +8797,23 @@ static int _nfs41_test_stateid(struct nfs_server *server, ...@@ -8797,6 +8797,23 @@ static int _nfs41_test_stateid(struct nfs_server *server,
return -res.status; return -res.status;
} }
static void nfs4_handle_delay_or_session_error(struct nfs_server *server,
int err, struct nfs4_exception *exception)
{
exception->retry = 0;
switch(err) {
case -NFS4ERR_DELAY:
nfs4_handle_exception(server, err, exception);
break;
case -NFS4ERR_BADSESSION:
case -NFS4ERR_BADSLOT:
case -NFS4ERR_BAD_HIGH_SLOT:
case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
case -NFS4ERR_DEADSESSION:
nfs4_do_handle_exception(server, err, exception);
}
}
/** /**
* nfs41_test_stateid - perform a TEST_STATEID operation * nfs41_test_stateid - perform a TEST_STATEID operation
* *
...@@ -8816,9 +8833,7 @@ static int nfs41_test_stateid(struct nfs_server *server, ...@@ -8816,9 +8833,7 @@ static int nfs41_test_stateid(struct nfs_server *server,
int err; int err;
do { do {
err = _nfs41_test_stateid(server, stateid, cred); err = _nfs41_test_stateid(server, stateid, cred);
if (err != -NFS4ERR_DELAY) nfs4_handle_delay_or_session_error(server, err, &exception);
break;
nfs4_handle_exception(server, err, &exception);
} while (exception.retry); } while (exception.retry);
return err; return err;
} }
......
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