recovery: avoid reclaim attempts out of grace period
nfs41_recover_client_state() remembers whether it's seen NFS4ERR_NO_GRACE, and will avoid sending RECLAIM_COMPLETE and the recovery versions of OPEN and LOCK Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
115ed7c1d3
commit
3734527757
1 changed files with 23 additions and 10 deletions
|
|
@ -65,7 +65,8 @@ void nfs41_recovery_finish(
|
||||||
|
|
||||||
static int recover_open(
|
static int recover_open(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
IN nfs41_open_state *open)
|
IN nfs41_open_state *open,
|
||||||
|
IN OUT bool_t *grace)
|
||||||
{
|
{
|
||||||
open_claim4 claim;
|
open_claim4 claim;
|
||||||
open_delegation4 delegation;
|
open_delegation4 delegation;
|
||||||
|
|
@ -76,11 +77,15 @@ static int recover_open(
|
||||||
claim.claim = CLAIM_PREVIOUS;
|
claim.claim = CLAIM_PREVIOUS;
|
||||||
claim.u.prev.delegate_type = OPEN_DELEGATE_NONE;
|
claim.u.prev.delegate_type = OPEN_DELEGATE_NONE;
|
||||||
|
|
||||||
|
if (*grace)
|
||||||
status = nfs41_open(session, &open->parent, &open->file,
|
status = nfs41_open(session, &open->parent, &open->file,
|
||||||
&open->owner, &claim, open->share_access, open->share_deny,
|
&open->owner, &claim, open->share_access, open->share_deny,
|
||||||
OPEN4_NOCREATE, 0, 0, FALSE, &stateid, &delegation, NULL);
|
OPEN4_NOCREATE, 0, 0, FALSE, &stateid, &delegation, NULL);
|
||||||
|
else
|
||||||
|
status = NFS4ERR_NO_GRACE;
|
||||||
|
|
||||||
if (status == NFS4ERR_NO_GRACE) {
|
if (status == NFS4ERR_NO_GRACE) {
|
||||||
|
*grace = FALSE;
|
||||||
/* attempt out-of-grace recovery with CLAIM_NULL */
|
/* attempt out-of-grace recovery with CLAIM_NULL */
|
||||||
claim.claim = CLAIM_NULL;
|
claim.claim = CLAIM_NULL;
|
||||||
claim.u.null.filename = &open->file.name;
|
claim.u.null.filename = &open->file.name;
|
||||||
|
|
@ -103,7 +108,8 @@ out:
|
||||||
|
|
||||||
static int recover_locks(
|
static int recover_locks(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
IN nfs41_open_state *open)
|
IN nfs41_open_state *open,
|
||||||
|
IN OUT bool_t *grace)
|
||||||
{
|
{
|
||||||
stateid_arg stateid;
|
stateid_arg stateid;
|
||||||
struct list_entry *entry;
|
struct list_entry *entry;
|
||||||
|
|
@ -120,9 +126,15 @@ static int recover_locks(
|
||||||
/* recover any locks for this open */
|
/* recover any locks for this open */
|
||||||
list_for_each(entry, &open->locks.list) {
|
list_for_each(entry, &open->locks.list) {
|
||||||
lock = list_container(entry, nfs41_lock_state, open_entry);
|
lock = list_container(entry, nfs41_lock_state, open_entry);
|
||||||
|
|
||||||
|
if (*grace)
|
||||||
status = nfs41_lock(session, &open->file, &open->owner,
|
status = nfs41_lock(session, &open->file, &open->owner,
|
||||||
lock->type, lock->offset, lock->length, TRUE, FALSE, &stateid);
|
lock->type, lock->offset, lock->length, TRUE, FALSE, &stateid);
|
||||||
|
else
|
||||||
|
status = NFS4ERR_NO_GRACE;
|
||||||
|
|
||||||
if (status == NFS4ERR_NO_GRACE) {
|
if (status == NFS4ERR_NO_GRACE) {
|
||||||
|
*grace = FALSE;
|
||||||
/* attempt out-of-grace recovery with a normal LOCK */
|
/* attempt out-of-grace recovery with a normal LOCK */
|
||||||
status = nfs41_lock(session, &open->file, &open->owner,
|
status = nfs41_lock(session, &open->file, &open->owner,
|
||||||
lock->type, lock->offset, lock->length, FALSE, FALSE, &stateid);
|
lock->type, lock->offset, lock->length, FALSE, FALSE, &stateid);
|
||||||
|
|
@ -152,15 +164,16 @@ int nfs41_recover_client_state(
|
||||||
struct client_state *state = &session->client->state;
|
struct client_state *state = &session->client->state;
|
||||||
struct list_entry *entry;
|
struct list_entry *entry;
|
||||||
nfs41_open_state *open;
|
nfs41_open_state *open;
|
||||||
|
bool_t grace = TRUE;
|
||||||
int status = NFS4_OK;
|
int status = NFS4_OK;
|
||||||
|
|
||||||
/* recover each of the client's opens */
|
/* recover each of the client's opens */
|
||||||
EnterCriticalSection(&state->lock);
|
EnterCriticalSection(&state->lock);
|
||||||
list_for_each(entry, &state->opens) {
|
list_for_each(entry, &state->opens) {
|
||||||
open = list_container(entry, nfs41_open_state, client_entry);
|
open = list_container(entry, nfs41_open_state, client_entry);
|
||||||
status = recover_open(session, open);
|
status = recover_open(session, open, &grace);
|
||||||
if (status == NFS4_OK)
|
if (status == NFS4_OK)
|
||||||
status = recover_locks(session, open);
|
status = recover_locks(session, open, &grace);
|
||||||
if (status == NFS4ERR_BADSESSION)
|
if (status == NFS4ERR_BADSESSION)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +182,7 @@ int nfs41_recover_client_state(
|
||||||
/* revoke all of the client's layouts */
|
/* revoke all of the client's layouts */
|
||||||
pnfs_file_layout_recall(client, &recall);
|
pnfs_file_layout_recall(client, &recall);
|
||||||
|
|
||||||
if (status != NFS4ERR_BADSESSION) {
|
if (grace && status != NFS4ERR_BADSESSION) {
|
||||||
/* send reclaim_complete, but don't fail on errors */
|
/* send reclaim_complete, but don't fail on errors */
|
||||||
status = nfs41_reclaim_complete(session);
|
status = nfs41_reclaim_complete(session);
|
||||||
if (status && status == NFS4ERR_NOTSUPP)
|
if (status && status == NFS4ERR_NOTSUPP)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue