Commit be76b5b6 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Clean up nfs4_open_delegation_recall

Make it symmetric with nfs4_lock_delegation_recall
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 4a706fa0
...@@ -1379,70 +1379,56 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta ...@@ -1379,70 +1379,56 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
return ret; return ret;
} }
static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid)
{ {
struct nfs_server *server = NFS_SERVER(state->inode);
struct nfs4_opendata *opendata; struct nfs4_opendata *opendata;
int ret; int err;
opendata = nfs4_open_recoverdata_alloc(ctx, state, opendata = nfs4_open_recoverdata_alloc(ctx, state,
NFS4_OPEN_CLAIM_DELEG_CUR_FH); NFS4_OPEN_CLAIM_DELEG_CUR_FH);
if (IS_ERR(opendata)) if (IS_ERR(opendata))
return PTR_ERR(opendata); return PTR_ERR(opendata);
nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid);
ret = nfs4_open_recover(opendata, state); err = nfs4_open_recover(opendata, state);
nfs4_opendata_put(opendata); nfs4_opendata_put(opendata);
return ret; switch (err) {
} default:
printk(KERN_ERR "NFS: %s: unhandled error "
int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) "%d.\n", __func__, err);
{ case 0:
struct nfs4_exception exception = { }; case -ENOENT:
struct nfs_server *server = NFS_SERVER(state->inode); case -ESTALE:
int err; break;
do { case -NFS4ERR_BADSESSION:
err = _nfs4_open_delegation_recall(ctx, state, stateid); case -NFS4ERR_BADSLOT:
switch (err) { case -NFS4ERR_BAD_HIGH_SLOT:
case 0: case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
case -ENOENT: case -NFS4ERR_DEADSESSION:
case -ESTALE: set_bit(NFS_DELEGATED_STATE, &state->flags);
goto out; nfs4_schedule_session_recovery(server->nfs_client->cl_session, err);
case -NFS4ERR_BADSESSION: return -EAGAIN;
case -NFS4ERR_BADSLOT: case -NFS4ERR_STALE_CLIENTID:
case -NFS4ERR_BAD_HIGH_SLOT: case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: set_bit(NFS_DELEGATED_STATE, &state->flags);
case -NFS4ERR_DEADSESSION: case -NFS4ERR_EXPIRED:
set_bit(NFS_DELEGATED_STATE, &state->flags); /* Don't recall a delegation if it was lost */
nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); nfs4_schedule_lease_recovery(server->nfs_client);
err = -EAGAIN; return -EAGAIN;
goto out; case -NFS4ERR_DELEG_REVOKED:
case -NFS4ERR_STALE_CLIENTID: case -NFS4ERR_ADMIN_REVOKED:
case -NFS4ERR_STALE_STATEID: case -NFS4ERR_BAD_STATEID:
set_bit(NFS_DELEGATED_STATE, &state->flags); nfs_inode_find_state_and_recover(state->inode,
case -NFS4ERR_EXPIRED: stateid);
/* Don't recall a delegation if it was lost */ nfs4_schedule_stateid_recovery(server, state);
nfs4_schedule_lease_recovery(server->nfs_client); case -ENOMEM:
err = -EAGAIN; return 0;
goto out; case -NFS4ERR_DELAY:
case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_GRACE:
case -NFS4ERR_ADMIN_REVOKED: set_bit(NFS_DELEGATED_STATE, &state->flags);
case -NFS4ERR_BAD_STATEID: ssleep(1);
nfs_inode_find_state_and_recover(state->inode, return -EAGAIN;
stateid); }
nfs4_schedule_stateid_recovery(server, state);
case -ENOMEM:
err = 0;
goto out;
case -NFS4ERR_DELAY:
case -NFS4ERR_GRACE:
set_bit(NFS_DELEGATED_STATE, &state->flags);
ssleep(1);
err = -EAGAIN;
goto out;
}
set_bit(NFS_DELEGATED_STATE, &state->flags);
err = nfs4_handle_exception(server, err, &exception);
} while (exception.retry);
out:
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