aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/pnfs.c20
-rw-r--r--fs/nfs/pnfs.h2
-rw-r--r--fs/nfs/read.c12
3 files changed, 19 insertions, 15 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a205c8e2c731..ee73d9a4f700 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1262,23 +1262,17 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_writepages);
1262/* 1262/*
1263 * Called by non rpc-based layout drivers 1263 * Called by non rpc-based layout drivers
1264 */ 1264 */
1265int 1265void pnfs_ld_read_done(struct nfs_read_data *data)
1266pnfs_ld_read_done(struct nfs_read_data *data)
1267{ 1266{
1268 int status; 1267 if (likely(!data->pnfs_error)) {
1269
1270 if (!data->pnfs_error) {
1271 __nfs4_read_done_cb(data); 1268 __nfs4_read_done_cb(data);
1272 data->mds_ops->rpc_call_done(&data->task, data); 1269 data->mds_ops->rpc_call_done(&data->task, data);
1273 data->mds_ops->rpc_release(data); 1270 } else {
1274 return 0; 1271 put_lseg(data->lseg);
1272 data->lseg = NULL;
1273 dprintk("pnfs write error = %d\n", data->pnfs_error);
1275 } 1274 }
1276 1275 data->mds_ops->rpc_release(data);
1277 dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
1278 data->pnfs_error);
1279 status = nfs_initiate_read(data, NFS_CLIENT(data->inode),
1280 data->mds_ops);
1281 return status ? : -EAGAIN;
1282} 1276}
1283EXPORT_SYMBOL_GPL(pnfs_ld_read_done); 1277EXPORT_SYMBOL_GPL(pnfs_ld_read_done);
1284 1278
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 71c23d40f735..1509530cb111 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -202,7 +202,7 @@ void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data);
202int pnfs_layoutcommit_inode(struct inode *inode, bool sync); 202int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
203int _pnfs_return_layout(struct inode *); 203int _pnfs_return_layout(struct inode *);
204void pnfs_ld_write_done(struct nfs_write_data *); 204void pnfs_ld_write_done(struct nfs_write_data *);
205int pnfs_ld_read_done(struct nfs_read_data *); 205void pnfs_ld_read_done(struct nfs_read_data *);
206struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, 206struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
207 struct nfs_open_context *ctx, 207 struct nfs_open_context *ctx,
208 loff_t pos, 208 loff_t pos,
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 2171c043ab08..bfc20b160243 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -541,13 +541,23 @@ static void nfs_readpage_result_full(struct rpc_task *task, void *calldata)
541static void nfs_readpage_release_full(void *calldata) 541static void nfs_readpage_release_full(void *calldata)
542{ 542{
543 struct nfs_read_data *data = calldata; 543 struct nfs_read_data *data = calldata;
544 struct nfs_pageio_descriptor pgio;
544 545
546 if (data->pnfs_error) {
547 nfs_pageio_init_read_mds(&pgio, data->inode);
548 pgio.pg_recoalesce = 1;
549 }
545 while (!list_empty(&data->pages)) { 550 while (!list_empty(&data->pages)) {
546 struct nfs_page *req = nfs_list_entry(data->pages.next); 551 struct nfs_page *req = nfs_list_entry(data->pages.next);
547 552
548 nfs_list_remove_request(req); 553 nfs_list_remove_request(req);
549 nfs_readpage_release(req); 554 if (!data->pnfs_error)
555 nfs_readpage_release(req);
556 else
557 nfs_pageio_add_request(&pgio, req);
550 } 558 }
559 if (data->pnfs_error)
560 nfs_pageio_complete(&pgio);
551 nfs_readdata_release(calldata); 561 nfs_readdata_release(calldata);
552} 562}
553 563