Commit 202b50dc authored by Trond Myklebust's avatar Trond Myklebust

[PATCH] NFSv4: Ensure that propagate NFSv4 state errors to the reclaim code

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent f0dd2136
...@@ -269,14 +269,9 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta ...@@ -269,14 +269,9 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
int err; int err;
do { do {
err = _nfs4_open_reclaim(sp, state); err = _nfs4_open_reclaim(sp, state);
switch (err) { if (err != -NFS4ERR_DELAY)
case 0: break;
case -NFS4ERR_STALE_CLIENTID: nfs4_handle_exception(server, err, &exception);
case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_EXPIRED:
return err;
}
err = nfs4_handle_exception(server, err, &exception);
} while (exception.retry); } while (exception.retry);
return err; return err;
} }
...@@ -508,6 +503,20 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st ...@@ -508,6 +503,20 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st
goto out_nodeleg; goto out_nodeleg;
} }
static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry)
{
struct nfs_server *server = NFS_SERVER(dentry->d_inode);
struct nfs4_exception exception = { };
int err;
do {
err = _nfs4_open_expired(sp, state, dentry);
if (err == -NFS4ERR_DELAY)
nfs4_handle_exception(server, err, &exception);
} while (exception.retry);
return err;
}
static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state) static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
{ {
struct nfs_inode *nfsi = NFS_I(state->inode); struct nfs_inode *nfsi = NFS_I(state->inode);
...@@ -520,7 +529,7 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta ...@@ -520,7 +529,7 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta
continue; continue;
get_nfs_open_context(ctx); get_nfs_open_context(ctx);
spin_unlock(&state->inode->i_lock); spin_unlock(&state->inode->i_lock);
status = _nfs4_open_expired(sp, state, ctx->dentry); status = nfs4_do_open_expired(sp, state, ctx->dentry);
put_nfs_open_context(ctx); put_nfs_open_context(ctx);
return status; return status;
} }
...@@ -2842,12 +2851,32 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *r ...@@ -2842,12 +2851,32 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *r
static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
{ {
return _nfs4_do_setlk(state, F_SETLK, request, 1); struct nfs_server *server = NFS_SERVER(state->inode);
struct nfs4_exception exception = { };
int err;
do {
err = _nfs4_do_setlk(state, F_SETLK, request, 1);
if (err != -NFS4ERR_DELAY)
break;
nfs4_handle_exception(server, err, &exception);
} while (exception.retry);
return err;
} }
static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
{ {
return _nfs4_do_setlk(state, F_SETLK, request, 0); struct nfs_server *server = NFS_SERVER(state->inode);
struct nfs4_exception exception = { };
int err;
do {
err = _nfs4_do_setlk(state, F_SETLK, request, 0);
if (err != -NFS4ERR_DELAY)
break;
nfs4_handle_exception(server, err, &exception);
} while (exception.retry);
return err;
} }
static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
......
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