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: Trond Myklebust <trond.myklebust@primarydata.com>
Tested-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Trond Myklebust 2016-09-22 13:38:56 -04:00 committed by Anna Schumaker
parent 4c8e544746
commit 43912bbbae

View File

@ -8797,6 +8797,23 @@ static int _nfs41_test_stateid(struct nfs_server *server,
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
*
@ -8816,9 +8833,7 @@ static int nfs41_test_stateid(struct nfs_server *server,
int err;
do {
err = _nfs41_test_stateid(server, stateid, cred);
if (err != -NFS4ERR_DELAY)
break;
nfs4_handle_exception(server, err, &exception);
nfs4_handle_delay_or_session_error(server, err, &exception);
} while (exception.retry);
return err;
}