aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4filelayout.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r--fs/nfs/nfs4filelayout.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 194c48410336..22d10623f5ee 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -99,7 +99,8 @@ static void filelayout_reset_write(struct nfs_write_data *data)
99 99
100 task->tk_status = pnfs_write_done_resend_to_mds(hdr->inode, 100 task->tk_status = pnfs_write_done_resend_to_mds(hdr->inode,
101 &hdr->pages, 101 &hdr->pages,
102 hdr->completion_ops); 102 hdr->completion_ops,
103 hdr->dreq);
103 } 104 }
104} 105}
105 106
@@ -119,7 +120,8 @@ static void filelayout_reset_read(struct nfs_read_data *data)
119 120
120 task->tk_status = pnfs_read_done_resend_to_mds(hdr->inode, 121 task->tk_status = pnfs_read_done_resend_to_mds(hdr->inode,
121 &hdr->pages, 122 &hdr->pages,
122 hdr->completion_ops); 123 hdr->completion_ops,
124 hdr->dreq);
123 } 125 }
124} 126}
125 127
@@ -127,7 +129,6 @@ static void filelayout_fenceme(struct inode *inode, struct pnfs_layout_hdr *lo)
127{ 129{
128 if (!test_and_clear_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) 130 if (!test_and_clear_bit(NFS_LAYOUT_RETURN, &lo->plh_flags))
129 return; 131 return;
130 clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags);
131 pnfs_return_layout(inode); 132 pnfs_return_layout(inode);
132} 133}
133 134
@@ -157,11 +158,14 @@ static int filelayout_async_handle_error(struct rpc_task *task,
157 case -NFS4ERR_OPENMODE: 158 case -NFS4ERR_OPENMODE:
158 if (state == NULL) 159 if (state == NULL)
159 break; 160 break;
160 nfs4_schedule_stateid_recovery(mds_server, state); 161 if (nfs4_schedule_stateid_recovery(mds_server, state) < 0)
162 goto out_bad_stateid;
161 goto wait_on_recovery; 163 goto wait_on_recovery;
162 case -NFS4ERR_EXPIRED: 164 case -NFS4ERR_EXPIRED:
163 if (state != NULL) 165 if (state != NULL) {
164 nfs4_schedule_stateid_recovery(mds_server, state); 166 if (nfs4_schedule_stateid_recovery(mds_server, state) < 0)
167 goto out_bad_stateid;
168 }
165 nfs4_schedule_lease_recovery(mds_client); 169 nfs4_schedule_lease_recovery(mds_client);
166 goto wait_on_recovery; 170 goto wait_on_recovery;
167 /* DS session errors */ 171 /* DS session errors */
@@ -225,6 +229,9 @@ reset:
225out: 229out:
226 task->tk_status = 0; 230 task->tk_status = 0;
227 return -EAGAIN; 231 return -EAGAIN;
232out_bad_stateid:
233 task->tk_status = -EIO;
234 return 0;
228wait_on_recovery: 235wait_on_recovery:
229 rpc_sleep_on(&mds_client->cl_rpcwaitq, task, NULL); 236 rpc_sleep_on(&mds_client->cl_rpcwaitq, task, NULL);
230 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &mds_client->cl_state) == 0) 237 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &mds_client->cl_state) == 0)
@@ -298,6 +305,10 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
298{ 305{
299 struct nfs_read_data *rdata = data; 306 struct nfs_read_data *rdata = data;
300 307
308 if (unlikely(test_bit(NFS_CONTEXT_BAD, &rdata->args.context->flags))) {
309 rpc_exit(task, -EIO);
310 return;
311 }
301 if (filelayout_reset_to_mds(rdata->header->lseg)) { 312 if (filelayout_reset_to_mds(rdata->header->lseg)) {
302 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); 313 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
303 filelayout_reset_read(rdata); 314 filelayout_reset_read(rdata);
@@ -306,10 +317,13 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
306 } 317 }
307 rdata->read_done_cb = filelayout_read_done_cb; 318 rdata->read_done_cb = filelayout_read_done_cb;
308 319
309 nfs41_setup_sequence(rdata->ds_clp->cl_session, 320 if (nfs41_setup_sequence(rdata->ds_clp->cl_session,
310 &rdata->args.seq_args, 321 &rdata->args.seq_args,
311 &rdata->res.seq_res, 322 &rdata->res.seq_res,
312 task); 323 task))
324 return;
325 nfs4_set_rw_stateid(&rdata->args.stateid, rdata->args.context,
326 rdata->args.lock_context, FMODE_READ);
313} 327}
314 328
315static void filelayout_read_call_done(struct rpc_task *task, void *data) 329static void filelayout_read_call_done(struct rpc_task *task, void *data)
@@ -400,16 +414,23 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
400{ 414{
401 struct nfs_write_data *wdata = data; 415 struct nfs_write_data *wdata = data;
402 416
417 if (unlikely(test_bit(NFS_CONTEXT_BAD, &wdata->args.context->flags))) {
418 rpc_exit(task, -EIO);
419 return;
420 }
403 if (filelayout_reset_to_mds(wdata->header->lseg)) { 421 if (filelayout_reset_to_mds(wdata->header->lseg)) {
404 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); 422 dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid);
405 filelayout_reset_write(wdata); 423 filelayout_reset_write(wdata);
406 rpc_exit(task, 0); 424 rpc_exit(task, 0);
407 return; 425 return;
408 } 426 }
409 nfs41_setup_sequence(wdata->ds_clp->cl_session, 427 if (nfs41_setup_sequence(wdata->ds_clp->cl_session,
410 &wdata->args.seq_args, 428 &wdata->args.seq_args,
411 &wdata->res.seq_res, 429 &wdata->res.seq_res,
412 task); 430 task))
431 return;
432 nfs4_set_rw_stateid(&wdata->args.stateid, wdata->args.context,
433 wdata->args.lock_context, FMODE_WRITE);
413} 434}
414 435
415static void filelayout_write_call_done(struct rpc_task *task, void *data) 436static void filelayout_write_call_done(struct rpc_task *task, void *data)