diff options
author | Andy Adamson <andros@netapp.com> | 2012-04-27 17:53:44 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-19 17:54:19 -0400 |
commit | 9f0ec176b3071e0472582c07ae1e68055b28184d (patch) | |
tree | a767381b136e8ac9f7839917b477fd7cd8cf9dc3 | |
parent | 90fecfcb3437dfc9bec4ee3306584dcd6843701b (diff) |
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>
-rw-r--r-- | fs/nfs/internal.h | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 10 | ||||
-rw-r--r-- | fs/nfs/read.c | 6 | ||||
-rw-r--r-- | fs/nfs/write.c | 13 |
4 files changed, 19 insertions, 16 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index bf64095f850d..6ed96c7ffcb2 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -299,7 +299,7 @@ extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, | |||
299 | const struct nfs_pgio_completion_ops *compl_ops); | 299 | const struct nfs_pgio_completion_ops *compl_ops); |
300 | extern int nfs_initiate_read(struct rpc_clnt *clnt, | 300 | extern int nfs_initiate_read(struct rpc_clnt *clnt, |
301 | struct nfs_read_data *data, | 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 | extern void nfs_read_prepare(struct rpc_task *task, void *calldata); | 303 | extern void nfs_read_prepare(struct rpc_task *task, void *calldata); |
304 | extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, | 304 | extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, |
305 | struct nfs_pgio_header *hdr); | 305 | struct nfs_pgio_header *hdr); |
@@ -326,13 +326,13 @@ extern void nfs_commit_free(struct nfs_commit_data *p); | |||
326 | extern int nfs_initiate_write(struct rpc_clnt *clnt, | 326 | extern int nfs_initiate_write(struct rpc_clnt *clnt, |
327 | struct nfs_write_data *data, | 327 | struct nfs_write_data *data, |
328 | const struct rpc_call_ops *call_ops, | 328 | const struct rpc_call_ops *call_ops, |
329 | int how); | 329 | int how, int flags); |
330 | extern void nfs_write_prepare(struct rpc_task *task, void *calldata); | 330 | extern void nfs_write_prepare(struct rpc_task *task, void *calldata); |
331 | extern void nfs_commit_prepare(struct rpc_task *task, void *calldata); | 331 | extern void nfs_commit_prepare(struct rpc_task *task, void *calldata); |
332 | extern int nfs_initiate_commit(struct rpc_clnt *clnt, | 332 | extern int nfs_initiate_commit(struct rpc_clnt *clnt, |
333 | struct nfs_commit_data *data, | 333 | struct nfs_commit_data *data, |
334 | const struct rpc_call_ops *call_ops, | 334 | const struct rpc_call_ops *call_ops, |
335 | int how); | 335 | int how, int flags); |
336 | extern void nfs_init_commit(struct nfs_commit_data *data, | 336 | extern void nfs_init_commit(struct nfs_commit_data *data, |
337 | struct list_head *head, | 337 | struct list_head *head, |
338 | struct pnfs_layout_segment *lseg, | 338 | struct pnfs_layout_segment *lseg, |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index b9edc8870561..0db8c0783039 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -401,7 +401,7 @@ filelayout_read_pagelist(struct nfs_read_data *data) | |||
401 | 401 | ||
402 | /* Perform an asynchronous read to ds */ | 402 | /* Perform an asynchronous read to ds */ |
403 | status = nfs_initiate_read(ds->ds_clp->cl_rpcclient, data, | 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 | BUG_ON(status != 0); | 405 | BUG_ON(status != 0); |
406 | return PNFS_ATTEMPTED; | 406 | return PNFS_ATTEMPTED; |
407 | } | 407 | } |
@@ -441,7 +441,8 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync) | |||
441 | 441 | ||
442 | /* Perform an asynchronous write */ | 442 | /* Perform an asynchronous write */ |
443 | status = nfs_initiate_write(ds->ds_clp->cl_rpcclient, data, | 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 | BUG_ON(status != 0); | 446 | BUG_ON(status != 0); |
446 | return PNFS_ATTEMPTED; | 447 | return PNFS_ATTEMPTED; |
447 | } | 448 | } |
@@ -966,7 +967,8 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how) | |||
966 | if (fh) | 967 | if (fh) |
967 | data->args.fh = fh; | 968 | data->args.fh = fh; |
968 | return nfs_initiate_commit(ds->ds_clp->cl_rpcclient, data, | 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 | static int | 974 | static int |
@@ -1120,7 +1122,7 @@ filelayout_commit_pagelist(struct inode *inode, struct list_head *mds_pages, | |||
1120 | if (!data->lseg) { | 1122 | if (!data->lseg) { |
1121 | nfs_init_commit(data, mds_pages, NULL, cinfo); | 1123 | nfs_init_commit(data, mds_pages, NULL, cinfo); |
1122 | nfs_initiate_commit(NFS_CLIENT(inode), data, | 1124 | nfs_initiate_commit(NFS_CLIENT(inode), data, |
1123 | data->mds_ops, how); | 1125 | data->mds_ops, how, 0); |
1124 | } else { | 1126 | } else { |
1125 | struct pnfs_commit_bucket *buckets; | 1127 | struct pnfs_commit_bucket *buckets; |
1126 | 1128 | ||
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index f23cf255bd39..2cfdd7785411 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -206,7 +206,7 @@ out: | |||
206 | 206 | ||
207 | int nfs_initiate_read(struct rpc_clnt *clnt, | 207 | int nfs_initiate_read(struct rpc_clnt *clnt, |
208 | struct nfs_read_data *data, | 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 | struct inode *inode = data->header->inode; | 211 | struct inode *inode = data->header->inode; |
212 | int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; | 212 | int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; |
@@ -223,7 +223,7 @@ int nfs_initiate_read(struct rpc_clnt *clnt, | |||
223 | .callback_ops = call_ops, | 223 | .callback_ops = call_ops, |
224 | .callback_data = data, | 224 | .callback_data = data, |
225 | .workqueue = nfsiod_workqueue, | 225 | .workqueue = nfsiod_workqueue, |
226 | .flags = RPC_TASK_ASYNC | swap_flags, | 226 | .flags = RPC_TASK_ASYNC | swap_flags | flags, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | /* Set up the initial task struct. */ | 229 | /* Set up the initial task struct. */ |
@@ -272,7 +272,7 @@ static int nfs_do_read(struct nfs_read_data *data, | |||
272 | { | 272 | { |
273 | struct inode *inode = data->header->inode; | 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 | static int | 278 | static int |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 8ffd7d5ed58b..e6fe3d69d14c 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -916,7 +916,7 @@ static int flush_task_priority(int how) | |||
916 | int nfs_initiate_write(struct rpc_clnt *clnt, | 916 | int nfs_initiate_write(struct rpc_clnt *clnt, |
917 | struct nfs_write_data *data, | 917 | struct nfs_write_data *data, |
918 | const struct rpc_call_ops *call_ops, | 918 | const struct rpc_call_ops *call_ops, |
919 | int how) | 919 | int how, int flags) |
920 | { | 920 | { |
921 | struct inode *inode = data->header->inode; | 921 | struct inode *inode = data->header->inode; |
922 | int priority = flush_task_priority(how); | 922 | int priority = flush_task_priority(how); |
@@ -933,7 +933,7 @@ int nfs_initiate_write(struct rpc_clnt *clnt, | |||
933 | .callback_ops = call_ops, | 933 | .callback_ops = call_ops, |
934 | .callback_data = data, | 934 | .callback_data = data, |
935 | .workqueue = nfsiod_workqueue, | 935 | .workqueue = nfsiod_workqueue, |
936 | .flags = RPC_TASK_ASYNC, | 936 | .flags = RPC_TASK_ASYNC | flags, |
937 | .priority = priority, | 937 | .priority = priority, |
938 | }; | 938 | }; |
939 | int ret = 0; | 939 | int ret = 0; |
@@ -1009,7 +1009,7 @@ static int nfs_do_write(struct nfs_write_data *data, | |||
1009 | { | 1009 | { |
1010 | struct inode *inode = data->header->inode; | 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 | static int nfs_do_multiple_writes(struct list_head *head, | 1015 | static int nfs_do_multiple_writes(struct list_head *head, |
@@ -1394,7 +1394,7 @@ EXPORT_SYMBOL_GPL(nfs_commitdata_release); | |||
1394 | 1394 | ||
1395 | int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, | 1395 | int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, |
1396 | const struct rpc_call_ops *call_ops, | 1396 | const struct rpc_call_ops *call_ops, |
1397 | int how) | 1397 | int how, int flags) |
1398 | { | 1398 | { |
1399 | struct rpc_task *task; | 1399 | struct rpc_task *task; |
1400 | int priority = flush_task_priority(how); | 1400 | int priority = flush_task_priority(how); |
@@ -1410,7 +1410,7 @@ int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, | |||
1410 | .callback_ops = call_ops, | 1410 | .callback_ops = call_ops, |
1411 | .callback_data = data, | 1411 | .callback_data = data, |
1412 | .workqueue = nfsiod_workqueue, | 1412 | .workqueue = nfsiod_workqueue, |
1413 | .flags = RPC_TASK_ASYNC, | 1413 | .flags = RPC_TASK_ASYNC | flags, |
1414 | .priority = priority, | 1414 | .priority = priority, |
1415 | }; | 1415 | }; |
1416 | /* Set up the initial task struct. */ | 1416 | /* Set up the initial task struct. */ |
@@ -1499,7 +1499,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how, | |||
1499 | /* Set up the argument struct */ | 1499 | /* Set up the argument struct */ |
1500 | nfs_init_commit(data, head, NULL, cinfo); | 1500 | nfs_init_commit(data, head, NULL, cinfo); |
1501 | atomic_inc(&cinfo->mds->rpcs_out); | 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 | out_bad: | 1504 | out_bad: |
1504 | nfs_retry_commit(head, NULL, cinfo); | 1505 | nfs_retry_commit(head, NULL, cinfo); |
1505 | cinfo->completion_ops->error_cleanup(NFS_I(inode)); | 1506 | cinfo->completion_ops->error_cleanup(NFS_I(inode)); |