diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-17 17:12:15 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:06 -0400 |
commit | a0b0a6e39bd1bb4a0922086feee73627cbd53ba4 (patch) | |
tree | 51921888aee9b74c3d6ad62b3546c858434f8925 /fs/nfs/nfs4proc.c | |
parent | d19751e7b9bd8a01d00372325439589886674f79 (diff) |
NFS: Clean up the pNFS layoutget interface
Ensure that we do return errors from nfs4_proc_layoutget() and that we
don't mark the layout as having failed if the error was due to a
signal or resource problem on the client side.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cf2fd5d0c1b3..1c8656f8745c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6286,7 +6286,8 @@ static const struct rpc_call_ops nfs4_layoutget_call_ops = { | |||
6286 | .rpc_release = nfs4_layoutget_release, | 6286 | .rpc_release = nfs4_layoutget_release, |
6287 | }; | 6287 | }; |
6288 | 6288 | ||
6289 | void nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | 6289 | struct pnfs_layout_segment * |
6290 | nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | ||
6290 | { | 6291 | { |
6291 | struct nfs_server *server = NFS_SERVER(lgp->args.inode); | 6292 | struct nfs_server *server = NFS_SERVER(lgp->args.inode); |
6292 | size_t max_pages = max_response_pages(server); | 6293 | size_t max_pages = max_response_pages(server); |
@@ -6303,6 +6304,7 @@ void nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | |||
6303 | .callback_data = lgp, | 6304 | .callback_data = lgp, |
6304 | .flags = RPC_TASK_ASYNC, | 6305 | .flags = RPC_TASK_ASYNC, |
6305 | }; | 6306 | }; |
6307 | struct pnfs_layout_segment *lseg = NULL; | ||
6306 | int status = 0; | 6308 | int status = 0; |
6307 | 6309 | ||
6308 | dprintk("--> %s\n", __func__); | 6310 | dprintk("--> %s\n", __func__); |
@@ -6310,7 +6312,7 @@ void nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | |||
6310 | lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); | 6312 | lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); |
6311 | if (!lgp->args.layout.pages) { | 6313 | if (!lgp->args.layout.pages) { |
6312 | nfs4_layoutget_release(lgp); | 6314 | nfs4_layoutget_release(lgp); |
6313 | return; | 6315 | return ERR_PTR(-ENOMEM); |
6314 | } | 6316 | } |
6315 | lgp->args.layout.pglen = max_pages * PAGE_SIZE; | 6317 | lgp->args.layout.pglen = max_pages * PAGE_SIZE; |
6316 | 6318 | ||
@@ -6319,15 +6321,17 @@ void nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | |||
6319 | nfs41_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); | 6321 | nfs41_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); |
6320 | task = rpc_run_task(&task_setup_data); | 6322 | task = rpc_run_task(&task_setup_data); |
6321 | if (IS_ERR(task)) | 6323 | if (IS_ERR(task)) |
6322 | return; | 6324 | return ERR_CAST(task); |
6323 | status = nfs4_wait_for_completion_rpc_task(task); | 6325 | status = nfs4_wait_for_completion_rpc_task(task); |
6324 | if (status == 0) | 6326 | if (status == 0) |
6325 | status = task->tk_status; | 6327 | status = task->tk_status; |
6326 | if (status == 0) | 6328 | if (status == 0) |
6327 | status = pnfs_layout_process(lgp); | 6329 | lseg = pnfs_layout_process(lgp); |
6328 | rpc_put_task(task); | 6330 | rpc_put_task(task); |
6329 | dprintk("<-- %s status=%d\n", __func__, status); | 6331 | dprintk("<-- %s status=%d\n", __func__, status); |
6330 | return; | 6332 | if (status) |
6333 | return ERR_PTR(status); | ||
6334 | return lseg; | ||
6331 | } | 6335 | } |
6332 | 6336 | ||
6333 | static void | 6337 | static void |