aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-04-14 14:54:53 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-04-19 16:53:08 -0400
commitdbae4c73f08b8a7980cc912954ade3d4c1fb6147 (patch)
tree8a1ddd0b9df5ae7e919a235e9c765266d68a0e3f /fs/nfs/read.c
parentc9d8f89d9816c1d16ada492aa547a4d692508c0d (diff)
NFS: Ensure that rpc_run_task() errors are propagated back to the caller
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 6f9208a549a0..16f57e0af999 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -153,7 +153,7 @@ static void nfs_readpage_release(struct nfs_page *req)
153/* 153/*
154 * Set up the NFS read request struct 154 * Set up the NFS read request struct
155 */ 155 */
156static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, 156static int nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
157 const struct rpc_call_ops *call_ops, 157 const struct rpc_call_ops *call_ops,
158 unsigned int count, unsigned int offset) 158 unsigned int count, unsigned int offset)
159{ 159{
@@ -202,8 +202,10 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
202 (unsigned long long)data->args.offset); 202 (unsigned long long)data->args.offset);
203 203
204 task = rpc_run_task(&task_setup_data); 204 task = rpc_run_task(&task_setup_data);
205 if (!IS_ERR(task)) 205 if (IS_ERR(task))
206 rpc_put_task(task); 206 return PTR_ERR(task);
207 rpc_put_task(task);
208 return 0;
207} 209}
208 210
209static void 211static void
@@ -240,6 +242,7 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
240 size_t rsize = NFS_SERVER(inode)->rsize, nbytes; 242 size_t rsize = NFS_SERVER(inode)->rsize, nbytes;
241 unsigned int offset; 243 unsigned int offset;
242 int requests = 0; 244 int requests = 0;
245 int ret = 0;
243 LIST_HEAD(list); 246 LIST_HEAD(list);
244 247
245 nfs_list_remove_request(req); 248 nfs_list_remove_request(req);
@@ -261,6 +264,8 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
261 offset = 0; 264 offset = 0;
262 nbytes = count; 265 nbytes = count;
263 do { 266 do {
267 int ret2;
268
264 data = list_entry(list.next, struct nfs_read_data, pages); 269 data = list_entry(list.next, struct nfs_read_data, pages);
265 list_del_init(&data->pages); 270 list_del_init(&data->pages);
266 271
@@ -268,13 +273,15 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
268 273
269 if (nbytes < rsize) 274 if (nbytes < rsize)
270 rsize = nbytes; 275 rsize = nbytes;
271 nfs_read_rpcsetup(req, data, &nfs_read_partial_ops, 276 ret2 = nfs_read_rpcsetup(req, data, &nfs_read_partial_ops,
272 rsize, offset); 277 rsize, offset);
278 if (ret == 0)
279 ret = ret2;
273 offset += rsize; 280 offset += rsize;
274 nbytes -= rsize; 281 nbytes -= rsize;
275 } while (nbytes != 0); 282 } while (nbytes != 0);
276 283
277 return 0; 284 return ret;
278 285
279out_bad: 286out_bad:
280 while (!list_empty(&list)) { 287 while (!list_empty(&list)) {
@@ -292,6 +299,7 @@ static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned
292 struct nfs_page *req; 299 struct nfs_page *req;
293 struct page **pages; 300 struct page **pages;
294 struct nfs_read_data *data; 301 struct nfs_read_data *data;
302 int ret = -ENOMEM;
295 303
296 data = nfs_readdata_alloc(npages); 304 data = nfs_readdata_alloc(npages);
297 if (!data) 305 if (!data)
@@ -307,11 +315,10 @@ static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned
307 } 315 }
308 req = nfs_list_entry(data->pages.next); 316 req = nfs_list_entry(data->pages.next);
309 317
310 nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0); 318 return nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0);
311 return 0;
312out_bad: 319out_bad:
313 nfs_async_read_error(head); 320 nfs_async_read_error(head);
314 return -ENOMEM; 321 return ret;
315} 322}
316 323
317/* 324/*