aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-22 20:28:44 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-05 18:30:48 -0500
commitd9afbd1b0889e7da6742e9c67ccc7becc4161f65 (patch)
tree7ca0f67463f1b438260713d4f028dabf98e25a03 /fs/nfs/nfs4proc.c
parent6ba7db3420c0dbf3ede16f19a593e6a80edc043f (diff)
NFSv4.1: Simplify the sequence setup
Nobody calls nfs4_setup_sequence or nfs41_setup_sequence without also calling rpc_call_start() on success. This commit therefore folds the rpc_call_start call into nfs41_setup_sequence(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c125
1 files changed, 49 insertions, 76 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 39d24158f97f..23b0c2fcb052 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -513,7 +513,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,
513 dprintk("--> %s\n", __func__); 513 dprintk("--> %s\n", __func__);
514 /* slot already allocated? */ 514 /* slot already allocated? */
515 if (res->sr_slot != NULL) 515 if (res->sr_slot != NULL)
516 return 0; 516 goto out_success;
517 517
518 tbl = &session->fc_slot_table; 518 tbl = &session->fc_slot_table;
519 519
@@ -563,6 +563,8 @@ int nfs41_setup_sequence(struct nfs4_session *session,
563 * set to 1 if an rpc level failure occurs. 563 * set to 1 if an rpc level failure occurs.
564 */ 564 */
565 res->sr_status = 1; 565 res->sr_status = 1;
566out_success:
567 rpc_call_start(task);
566 return 0; 568 return 0;
567} 569}
568EXPORT_SYMBOL_GPL(nfs41_setup_sequence); 570EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
@@ -575,8 +577,10 @@ int nfs4_setup_sequence(const struct nfs_server *server,
575 struct nfs4_session *session = nfs4_get_session(server); 577 struct nfs4_session *session = nfs4_get_session(server);
576 int ret = 0; 578 int ret = 0;
577 579
578 if (session == NULL) 580 if (session == NULL) {
581 rpc_call_start(task);
579 goto out; 582 goto out;
583 }
580 584
581 dprintk("--> %s clp %p session %p sr_slot %d\n", 585 dprintk("--> %s clp %p session %p sr_slot %d\n",
582 __func__, session->clp, session, res->sr_slot ? 586 __func__, session->clp, session, res->sr_slot ?
@@ -601,10 +605,7 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
601 605
602 dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server); 606 dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server);
603 607
604 if (nfs41_setup_sequence(session, data->seq_args, 608 nfs41_setup_sequence(session, data->seq_args, data->seq_res, task);
605 data->seq_res, task))
606 return;
607 rpc_call_start(task);
608} 609}
609 610
610static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata) 611static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata)
@@ -1485,8 +1486,6 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
1485 &data->o_res.seq_res, 1486 &data->o_res.seq_res,
1486 task) != 0) 1487 task) != 0)
1487 nfs_release_seqid(data->o_arg.seqid); 1488 nfs_release_seqid(data->o_arg.seqid);
1488 else
1489 rpc_call_start(task);
1490 return; 1489 return;
1491unlock_no_action: 1490unlock_no_action:
1492 rcu_read_unlock(); 1491 rcu_read_unlock();
@@ -2192,8 +2191,6 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
2192 &calldata->res.seq_res, 2191 &calldata->res.seq_res,
2193 task) != 0) 2192 task) != 0)
2194 nfs_release_seqid(calldata->arg.seqid); 2193 nfs_release_seqid(calldata->arg.seqid);
2195 else
2196 rpc_call_start(task);
2197out: 2194out:
2198 dprintk("%s: done!\n", __func__); 2195 dprintk("%s: done!\n", __func__);
2199} 2196}
@@ -2932,12 +2929,10 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
2932 2929
2933static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data) 2930static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
2934{ 2931{
2935 if (nfs4_setup_sequence(NFS_SERVER(data->dir), 2932 nfs4_setup_sequence(NFS_SERVER(data->dir),
2936 &data->args.seq_args, 2933 &data->args.seq_args,
2937 &data->res.seq_res, 2934 &data->res.seq_res,
2938 task)) 2935 task);
2939 return;
2940 rpc_call_start(task);
2941} 2936}
2942 2937
2943static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) 2938static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
@@ -2965,12 +2960,10 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
2965 2960
2966static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data) 2961static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
2967{ 2962{
2968 if (nfs4_setup_sequence(NFS_SERVER(data->old_dir), 2963 nfs4_setup_sequence(NFS_SERVER(data->old_dir),
2969 &data->args.seq_args, 2964 &data->args.seq_args,
2970 &data->res.seq_res, 2965 &data->res.seq_res,
2971 task)) 2966 task);
2972 return;
2973 rpc_call_start(task);
2974} 2967}
2975 2968
2976static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir, 2969static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
@@ -3459,12 +3452,10 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
3459 3452
3460static void nfs4_proc_read_rpc_prepare(struct rpc_task *task, struct nfs_read_data *data) 3453static void nfs4_proc_read_rpc_prepare(struct rpc_task *task, struct nfs_read_data *data)
3461{ 3454{
3462 if (nfs4_setup_sequence(NFS_SERVER(data->header->inode), 3455 nfs4_setup_sequence(NFS_SERVER(data->header->inode),
3463 &data->args.seq_args, 3456 &data->args.seq_args,
3464 &data->res.seq_res, 3457 &data->res.seq_res,
3465 task)) 3458 task);
3466 return;
3467 rpc_call_start(task);
3468} 3459}
3469 3460
3470static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data) 3461static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data)
@@ -3525,22 +3516,18 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag
3525 3516
3526static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data) 3517static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data)
3527{ 3518{
3528 if (nfs4_setup_sequence(NFS_SERVER(data->header->inode), 3519 nfs4_setup_sequence(NFS_SERVER(data->header->inode),
3529 &data->args.seq_args, 3520 &data->args.seq_args,
3530 &data->res.seq_res, 3521 &data->res.seq_res,
3531 task)) 3522 task);
3532 return;
3533 rpc_call_start(task);
3534} 3523}
3535 3524
3536static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data) 3525static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)
3537{ 3526{
3538 if (nfs4_setup_sequence(NFS_SERVER(data->inode), 3527 nfs4_setup_sequence(NFS_SERVER(data->inode),
3539 &data->args.seq_args, 3528 &data->args.seq_args,
3540 &data->res.seq_res, 3529 &data->res.seq_res,
3541 task)) 3530 task);
3542 return;
3543 rpc_call_start(task);
3544} 3531}
3545 3532
3546static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_commit_data *data) 3533static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_commit_data *data)
@@ -4187,11 +4174,10 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data)
4187 4174
4188 d_data = (struct nfs4_delegreturndata *)data; 4175 d_data = (struct nfs4_delegreturndata *)data;
4189 4176
4190 if (nfs4_setup_sequence(d_data->res.server, 4177 nfs4_setup_sequence(d_data->res.server,
4191 &d_data->args.seq_args, 4178 &d_data->args.seq_args,
4192 &d_data->res.seq_res, task)) 4179 &d_data->res.seq_res,
4193 return; 4180 task);
4194 rpc_call_start(task);
4195} 4181}
4196#endif /* CONFIG_NFS_V4_1 */ 4182#endif /* CONFIG_NFS_V4_1 */
4197 4183
@@ -4445,8 +4431,6 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
4445 &calldata->res.seq_res, 4431 &calldata->res.seq_res,
4446 task) != 0) 4432 task) != 0)
4447 nfs_release_seqid(calldata->arg.seqid); 4433 nfs_release_seqid(calldata->arg.seqid);
4448 else
4449 rpc_call_start(task);
4450} 4434}
4451 4435
4452static const struct rpc_call_ops nfs4_locku_ops = { 4436static const struct rpc_call_ops nfs4_locku_ops = {
@@ -4601,10 +4585,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
4601 if (nfs4_setup_sequence(data->server, 4585 if (nfs4_setup_sequence(data->server,
4602 &data->arg.seq_args, 4586 &data->arg.seq_args,
4603 &data->res.seq_res, 4587 &data->res.seq_res,
4604 task) == 0) { 4588 task) == 0)
4605 rpc_call_start(task);
4606 return; 4589 return;
4607 }
4608 nfs_release_seqid(data->arg.open_seqid); 4590 nfs_release_seqid(data->arg.open_seqid);
4609out_release_lock_seqid: 4591out_release_lock_seqid:
4610 nfs_release_seqid(data->arg.lock_seqid); 4592 nfs_release_seqid(data->arg.lock_seqid);
@@ -5462,7 +5444,6 @@ struct nfs4_get_lease_time_data {
5462static void nfs4_get_lease_time_prepare(struct rpc_task *task, 5444static void nfs4_get_lease_time_prepare(struct rpc_task *task,
5463 void *calldata) 5445 void *calldata)
5464{ 5446{
5465 int ret;
5466 struct nfs4_get_lease_time_data *data = 5447 struct nfs4_get_lease_time_data *data =
5467 (struct nfs4_get_lease_time_data *)calldata; 5448 (struct nfs4_get_lease_time_data *)calldata;
5468 5449
@@ -5470,12 +5451,10 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task,
5470 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); 5451 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
5471 /* just setup sequence, do not trigger session recovery 5452 /* just setup sequence, do not trigger session recovery
5472 since we're invoked within one */ 5453 since we're invoked within one */
5473 ret = nfs41_setup_sequence(data->clp->cl_session, 5454 nfs41_setup_sequence(data->clp->cl_session,
5474 &data->args->la_seq_args, 5455 &data->args->la_seq_args,
5475 &data->res->lr_seq_res, task); 5456 &data->res->lr_seq_res,
5476 5457 task);
5477 if (ret != -EAGAIN)
5478 rpc_call_start(task);
5479 dprintk("<-- %s\n", __func__); 5458 dprintk("<-- %s\n", __func__);
5480} 5459}
5481 5460
@@ -5809,9 +5788,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data)
5809 args = task->tk_msg.rpc_argp; 5788 args = task->tk_msg.rpc_argp;
5810 res = task->tk_msg.rpc_resp; 5789 res = task->tk_msg.rpc_resp;
5811 5790
5812 if (nfs41_setup_sequence(clp->cl_session, args, res, task)) 5791 nfs41_setup_sequence(clp->cl_session, args, res, task);
5813 return;
5814 rpc_call_start(task);
5815} 5792}
5816 5793
5817static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void *data) 5794static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void *data)
@@ -5914,12 +5891,10 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data)
5914 struct nfs4_reclaim_complete_data *calldata = data; 5891 struct nfs4_reclaim_complete_data *calldata = data;
5915 5892
5916 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); 5893 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
5917 if (nfs41_setup_sequence(calldata->clp->cl_session, 5894 nfs41_setup_sequence(calldata->clp->cl_session,
5918 &calldata->arg.seq_args, 5895 &calldata->arg.seq_args,
5919 &calldata->res.seq_res, task)) 5896 &calldata->res.seq_res,
5920 return; 5897 task);
5921
5922 rpc_call_start(task);
5923} 5898}
5924 5899
5925static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nfs_client *clp) 5900static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nfs_client *clp)
@@ -6034,9 +6009,7 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
6034 NFS_I(lgp->args.inode)->layout, 6009 NFS_I(lgp->args.inode)->layout,
6035 lgp->args.ctx->state)) { 6010 lgp->args.ctx->state)) {
6036 rpc_exit(task, NFS4_OK); 6011 rpc_exit(task, NFS4_OK);
6037 return;
6038 } 6012 }
6039 rpc_call_start(task);
6040} 6013}
6041 6014
6042static void nfs4_layoutget_done(struct rpc_task *task, void *calldata) 6015static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
@@ -6200,10 +6173,10 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
6200 struct nfs4_layoutreturn *lrp = calldata; 6173 struct nfs4_layoutreturn *lrp = calldata;
6201 6174
6202 dprintk("--> %s\n", __func__); 6175 dprintk("--> %s\n", __func__);
6203 if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args, 6176 nfs41_setup_sequence(lrp->clp->cl_session,
6204 &lrp->res.seq_res, task)) 6177 &lrp->args.seq_args,
6205 return; 6178 &lrp->res.seq_res,
6206 rpc_call_start(task); 6179 task);
6207} 6180}
6208 6181
6209static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) 6182static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
@@ -6364,10 +6337,10 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata)
6364 struct nfs_server *server = NFS_SERVER(data->args.inode); 6337 struct nfs_server *server = NFS_SERVER(data->args.inode);
6365 struct nfs4_session *session = nfs4_get_session(server); 6338 struct nfs4_session *session = nfs4_get_session(server);
6366 6339
6367 if (nfs41_setup_sequence(session, &data->args.seq_args, 6340 nfs41_setup_sequence(session,
6368 &data->res.seq_res, task)) 6341 &data->args.seq_args,
6369 return; 6342 &data->res.seq_res,
6370 rpc_call_start(task); 6343 task);
6371} 6344}
6372 6345
6373static void 6346static void