Commit 9f0ec176b3071e0472582c07ae1e68055b28184d
Committed by
Trond Myklebust
1 parent
90fecfcb34
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
NFSv4.1 set RPC_TASK_SOFTCONN for filelayout DS RPC calls
RPC_TASK_SOFTCONN returns connection errors to the caller which allows the pNFS file layout to quickly try the MDS or perhaps another DS. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 4 changed files with 19 additions and 16 deletions Side-by-side Diff
fs/nfs/internal.h
... | ... | @@ -299,7 +299,7 @@ |
299 | 299 | const struct nfs_pgio_completion_ops *compl_ops); |
300 | 300 | extern int nfs_initiate_read(struct rpc_clnt *clnt, |
301 | 301 | struct nfs_read_data *data, |
302 | - const struct rpc_call_ops *call_ops); | |
302 | + const struct rpc_call_ops *call_ops, int flags); | |
303 | 303 | extern void nfs_read_prepare(struct rpc_task *task, void *calldata); |
304 | 304 | extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, |
305 | 305 | struct nfs_pgio_header *hdr); |
306 | 306 | |
... | ... | @@ -326,13 +326,13 @@ |
326 | 326 | extern int nfs_initiate_write(struct rpc_clnt *clnt, |
327 | 327 | struct nfs_write_data *data, |
328 | 328 | const struct rpc_call_ops *call_ops, |
329 | - int how); | |
329 | + int how, int flags); | |
330 | 330 | extern void nfs_write_prepare(struct rpc_task *task, void *calldata); |
331 | 331 | extern void nfs_commit_prepare(struct rpc_task *task, void *calldata); |
332 | 332 | extern int nfs_initiate_commit(struct rpc_clnt *clnt, |
333 | 333 | struct nfs_commit_data *data, |
334 | 334 | const struct rpc_call_ops *call_ops, |
335 | - int how); | |
335 | + int how, int flags); | |
336 | 336 | extern void nfs_init_commit(struct nfs_commit_data *data, |
337 | 337 | struct list_head *head, |
338 | 338 | struct pnfs_layout_segment *lseg, |
fs/nfs/nfs4filelayout.c
... | ... | @@ -401,7 +401,7 @@ |
401 | 401 | |
402 | 402 | /* Perform an asynchronous read to ds */ |
403 | 403 | status = nfs_initiate_read(ds->ds_clp->cl_rpcclient, data, |
404 | - &filelayout_read_call_ops); | |
404 | + &filelayout_read_call_ops, RPC_TASK_SOFTCONN); | |
405 | 405 | BUG_ON(status != 0); |
406 | 406 | return PNFS_ATTEMPTED; |
407 | 407 | } |
... | ... | @@ -441,7 +441,8 @@ |
441 | 441 | |
442 | 442 | /* Perform an asynchronous write */ |
443 | 443 | status = nfs_initiate_write(ds->ds_clp->cl_rpcclient, data, |
444 | - &filelayout_write_call_ops, sync); | |
444 | + &filelayout_write_call_ops, sync, | |
445 | + RPC_TASK_SOFTCONN); | |
445 | 446 | BUG_ON(status != 0); |
446 | 447 | return PNFS_ATTEMPTED; |
447 | 448 | } |
... | ... | @@ -966,7 +967,8 @@ |
966 | 967 | if (fh) |
967 | 968 | data->args.fh = fh; |
968 | 969 | return nfs_initiate_commit(ds->ds_clp->cl_rpcclient, data, |
969 | - &filelayout_commit_call_ops, how); | |
970 | + &filelayout_commit_call_ops, how, | |
971 | + RPC_TASK_SOFTCONN); | |
970 | 972 | } |
971 | 973 | |
972 | 974 | static int |
... | ... | @@ -1120,7 +1122,7 @@ |
1120 | 1122 | if (!data->lseg) { |
1121 | 1123 | nfs_init_commit(data, mds_pages, NULL, cinfo); |
1122 | 1124 | nfs_initiate_commit(NFS_CLIENT(inode), data, |
1123 | - data->mds_ops, how); | |
1125 | + data->mds_ops, how, 0); | |
1124 | 1126 | } else { |
1125 | 1127 | struct pnfs_commit_bucket *buckets; |
1126 | 1128 |
fs/nfs/read.c
... | ... | @@ -206,7 +206,7 @@ |
206 | 206 | |
207 | 207 | int nfs_initiate_read(struct rpc_clnt *clnt, |
208 | 208 | struct nfs_read_data *data, |
209 | - const struct rpc_call_ops *call_ops) | |
209 | + const struct rpc_call_ops *call_ops, int flags) | |
210 | 210 | { |
211 | 211 | struct inode *inode = data->header->inode; |
212 | 212 | int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; |
... | ... | @@ -223,7 +223,7 @@ |
223 | 223 | .callback_ops = call_ops, |
224 | 224 | .callback_data = data, |
225 | 225 | .workqueue = nfsiod_workqueue, |
226 | - .flags = RPC_TASK_ASYNC | swap_flags, | |
226 | + .flags = RPC_TASK_ASYNC | swap_flags | flags, | |
227 | 227 | }; |
228 | 228 | |
229 | 229 | /* Set up the initial task struct. */ |
... | ... | @@ -272,7 +272,7 @@ |
272 | 272 | { |
273 | 273 | struct inode *inode = data->header->inode; |
274 | 274 | |
275 | - return nfs_initiate_read(NFS_CLIENT(inode), data, call_ops); | |
275 | + return nfs_initiate_read(NFS_CLIENT(inode), data, call_ops, 0); | |
276 | 276 | } |
277 | 277 | |
278 | 278 | static int |
fs/nfs/write.c
... | ... | @@ -916,7 +916,7 @@ |
916 | 916 | int nfs_initiate_write(struct rpc_clnt *clnt, |
917 | 917 | struct nfs_write_data *data, |
918 | 918 | const struct rpc_call_ops *call_ops, |
919 | - int how) | |
919 | + int how, int flags) | |
920 | 920 | { |
921 | 921 | struct inode *inode = data->header->inode; |
922 | 922 | int priority = flush_task_priority(how); |
... | ... | @@ -933,7 +933,7 @@ |
933 | 933 | .callback_ops = call_ops, |
934 | 934 | .callback_data = data, |
935 | 935 | .workqueue = nfsiod_workqueue, |
936 | - .flags = RPC_TASK_ASYNC, | |
936 | + .flags = RPC_TASK_ASYNC | flags, | |
937 | 937 | .priority = priority, |
938 | 938 | }; |
939 | 939 | int ret = 0; |
... | ... | @@ -1009,7 +1009,7 @@ |
1009 | 1009 | { |
1010 | 1010 | struct inode *inode = data->header->inode; |
1011 | 1011 | |
1012 | - return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how); | |
1012 | + return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0); | |
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | static int nfs_do_multiple_writes(struct list_head *head, |
... | ... | @@ -1394,7 +1394,7 @@ |
1394 | 1394 | |
1395 | 1395 | int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, |
1396 | 1396 | const struct rpc_call_ops *call_ops, |
1397 | - int how) | |
1397 | + int how, int flags) | |
1398 | 1398 | { |
1399 | 1399 | struct rpc_task *task; |
1400 | 1400 | int priority = flush_task_priority(how); |
... | ... | @@ -1410,7 +1410,7 @@ |
1410 | 1410 | .callback_ops = call_ops, |
1411 | 1411 | .callback_data = data, |
1412 | 1412 | .workqueue = nfsiod_workqueue, |
1413 | - .flags = RPC_TASK_ASYNC, | |
1413 | + .flags = RPC_TASK_ASYNC | flags, | |
1414 | 1414 | .priority = priority, |
1415 | 1415 | }; |
1416 | 1416 | /* Set up the initial task struct. */ |
... | ... | @@ -1499,7 +1499,8 @@ |
1499 | 1499 | /* Set up the argument struct */ |
1500 | 1500 | nfs_init_commit(data, head, NULL, cinfo); |
1501 | 1501 | atomic_inc(&cinfo->mds->rpcs_out); |
1502 | - return nfs_initiate_commit(NFS_CLIENT(inode), data, data->mds_ops, how); | |
1502 | + return nfs_initiate_commit(NFS_CLIENT(inode), data, data->mds_ops, | |
1503 | + how, 0); | |
1503 | 1504 | out_bad: |
1504 | 1505 | nfs_retry_commit(head, NULL, cinfo); |
1505 | 1506 | cinfo->completion_ops->error_cleanup(NFS_I(inode)); |