aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4filelayout.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-03-14 16:57:48 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-03-25 12:04:10 -0400
commit5d422301f97b821301efcdb6fc9d1a83a5c102d6 (patch)
treeed7117feb89a0a804669f9f017d2ce3ef7fee10c /fs/nfs/nfs4filelayout.c
parent3ed5e2a2c394df4e03a680842c2d07a8680f133b (diff)
NFSv4: Fail I/O if the state recovery fails irrevocably
If state recovery fails with an ESTALE or a ENOENT, then we shouldn't keep retrying. Instead, mark the stateid as being invalid and fail the I/O with an EIO error. For other operations such as POSIX and BSD file locking, truncate etc, fail with an EBADF to indicate that this file descriptor is no longer valid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r--fs/nfs/nfs4filelayout.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 4fb234d3aefb..1ee5737211d7 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -158,11 +158,14 @@ static int filelayout_async_handle_error(struct rpc_task *task,
158 case -NFS4ERR_OPENMODE: 158 case -NFS4ERR_OPENMODE:
159 if (state == NULL) 159 if (state == NULL)
160 break; 160 break;
161 nfs4_schedule_stateid_recovery(mds_server, state); 161 if (nfs4_schedule_stateid_recovery(mds_server, state) < 0)
162 goto out_bad_stateid;
162 goto wait_on_recovery; 163 goto wait_on_recovery;
163 case -NFS4ERR_EXPIRED: 164 case -NFS4ERR_EXPIRED:
164 if (state != NULL) 165 if (state != NULL) {
165 nfs4_schedule_stateid_recovery(mds_server, state); 166 if (nfs4_schedule_stateid_recovery(mds_server, state) < 0)
167 goto out_bad_stateid;
168 }
166 nfs4_schedule_lease_recovery(mds_client); 169 nfs4_schedule_lease_recovery(mds_client);
167 goto wait_on_recovery; 170 goto wait_on_recovery;
168 /* DS session errors */ 171 /* DS session errors */
@@ -226,6 +229,9 @@ reset:
226out: 229out:
227 task->tk_status = 0; 230 task->tk_status = 0;
228 return -EAGAIN; 231 return -EAGAIN;
232out_bad_stateid:
233 task->tk_status = -EIO;
234 return 0;
229wait_on_recovery: 235wait_on_recovery:
230 rpc_sleep_on(&mds_client->cl_rpcwaitq, task, NULL); 236 rpc_sleep_on(&mds_client->cl_rpcwaitq, task, NULL);
231 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &mds_client->cl_state) == 0) 237 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &mds_client->cl_state) == 0)