aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 75847e4898a0..0168007b78d2 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -531,20 +531,25 @@ static int nfs41_setup_sequence(struct nfs4_session *session,
531 return 0; 531 return 0;
532} 532}
533 533
534int nfs4_setup_sequence(struct nfs_client *clp, 534int nfs4_setup_sequence(const struct nfs_server *server,
535 struct nfs4_sequence_args *args, 535 struct nfs4_sequence_args *args,
536 struct nfs4_sequence_res *res, 536 struct nfs4_sequence_res *res,
537 int cache_reply, 537 int cache_reply,
538 struct rpc_task *task) 538 struct rpc_task *task)
539{ 539{
540 struct nfs4_session *session = nfs4_get_session(server);
540 int ret = 0; 541 int ret = 0;
541 542
543 if (session == NULL) {
544 args->sa_session = NULL;
545 res->sr_session = NULL;
546 goto out;
547 }
548
542 dprintk("--> %s clp %p session %p sr_slotid %d\n", 549 dprintk("--> %s clp %p session %p sr_slotid %d\n",
543 __func__, clp, clp->cl_session, res->sr_slotid); 550 __func__, session->clp, session, res->sr_slotid);
544 551
545 if (!nfs4_has_session(clp)) 552 ret = nfs41_setup_sequence(session, args, res, cache_reply,
546 goto out;
547 ret = nfs41_setup_sequence(clp->cl_session, args, res, cache_reply,
548 task); 553 task);
549out: 554out:
550 dprintk("<-- %s status=%d\n", __func__, ret); 555 dprintk("<-- %s status=%d\n", __func__, ret);
@@ -552,7 +557,7 @@ out:
552} 557}
553 558
554struct nfs41_call_sync_data { 559struct nfs41_call_sync_data {
555 struct nfs_client *clp; 560 const struct nfs_server *seq_server;
556 struct nfs4_sequence_args *seq_args; 561 struct nfs4_sequence_args *seq_args;
557 struct nfs4_sequence_res *seq_res; 562 struct nfs4_sequence_res *seq_res;
558 int cache_reply; 563 int cache_reply;
@@ -562,9 +567,9 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
562{ 567{
563 struct nfs41_call_sync_data *data = calldata; 568 struct nfs41_call_sync_data *data = calldata;
564 569
565 dprintk("--> %s data->clp->cl_session %p\n", __func__, 570 dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server);
566 data->clp->cl_session); 571
567 if (nfs4_setup_sequence(data->clp, data->seq_args, 572 if (nfs4_setup_sequence(data->seq_server, data->seq_args,
568 data->seq_res, data->cache_reply, task)) 573 data->seq_res, data->cache_reply, task))
569 return; 574 return;
570 rpc_call_start(task); 575 rpc_call_start(task);
@@ -593,8 +598,7 @@ struct rpc_call_ops nfs41_call_priv_sync_ops = {
593 .rpc_call_done = nfs41_call_sync_done, 598 .rpc_call_done = nfs41_call_sync_done,
594}; 599};
595 600
596static int nfs4_call_sync_sequence(struct nfs_client *clp, 601static int nfs4_call_sync_sequence(struct nfs_server *server,
597 struct rpc_clnt *clnt,
598 struct rpc_message *msg, 602 struct rpc_message *msg,
599 struct nfs4_sequence_args *args, 603 struct nfs4_sequence_args *args,
600 struct nfs4_sequence_res *res, 604 struct nfs4_sequence_res *res,
@@ -604,13 +608,13 @@ static int nfs4_call_sync_sequence(struct nfs_client *clp,
604 int ret; 608 int ret;
605 struct rpc_task *task; 609 struct rpc_task *task;
606 struct nfs41_call_sync_data data = { 610 struct nfs41_call_sync_data data = {
607 .clp = clp, 611 .seq_server = server,
608 .seq_args = args, 612 .seq_args = args,
609 .seq_res = res, 613 .seq_res = res,
610 .cache_reply = cache_reply, 614 .cache_reply = cache_reply,
611 }; 615 };
612 struct rpc_task_setup task_setup = { 616 struct rpc_task_setup task_setup = {
613 .rpc_client = clnt, 617 .rpc_client = server->client,
614 .rpc_message = msg, 618 .rpc_message = msg,
615 .callback_ops = &nfs41_call_sync_ops, 619 .callback_ops = &nfs41_call_sync_ops,
616 .callback_data = &data 620 .callback_data = &data
@@ -635,8 +639,7 @@ int _nfs4_call_sync_session(struct nfs_server *server,
635 struct nfs4_sequence_res *res, 639 struct nfs4_sequence_res *res,
636 int cache_reply) 640 int cache_reply)
637{ 641{
638 return nfs4_call_sync_sequence(server->nfs_client, server->client, 642 return nfs4_call_sync_sequence(server, msg, args, res, cache_reply, 0);
639 msg, args, res, cache_reply, 0);
640} 643}
641 644
642#endif /* CONFIG_NFS_V4_1 */ 645#endif /* CONFIG_NFS_V4_1 */
@@ -1355,7 +1358,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
1355 nfs_copy_fh(&data->o_res.fh, data->o_arg.fh); 1358 nfs_copy_fh(&data->o_res.fh, data->o_arg.fh);
1356 } 1359 }
1357 data->timestamp = jiffies; 1360 data->timestamp = jiffies;
1358 if (nfs4_setup_sequence(data->o_arg.server->nfs_client, 1361 if (nfs4_setup_sequence(data->o_arg.server,
1359 &data->o_arg.seq_args, 1362 &data->o_arg.seq_args,
1360 &data->o_res.seq_res, 1, task)) 1363 &data->o_res.seq_res, 1, task))
1361 return; 1364 return;
@@ -1896,7 +1899,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
1896 1899
1897 nfs_fattr_init(calldata->res.fattr); 1900 nfs_fattr_init(calldata->res.fattr);
1898 calldata->timestamp = jiffies; 1901 calldata->timestamp = jiffies;
1899 if (nfs4_setup_sequence((NFS_SERVER(calldata->inode))->nfs_client, 1902 if (nfs4_setup_sequence(NFS_SERVER(calldata->inode),
1900 &calldata->arg.seq_args, &calldata->res.seq_res, 1903 &calldata->arg.seq_args, &calldata->res.seq_res,
1901 1, task)) 1904 1, task))
1902 return; 1905 return;
@@ -3660,7 +3663,7 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data)
3660 3663
3661 d_data = (struct nfs4_delegreturndata *)data; 3664 d_data = (struct nfs4_delegreturndata *)data;
3662 3665
3663 if (nfs4_setup_sequence(d_data->res.server->nfs_client, 3666 if (nfs4_setup_sequence(d_data->res.server,
3664 &d_data->args.seq_args, 3667 &d_data->args.seq_args,
3665 &d_data->res.seq_res, 1, task)) 3668 &d_data->res.seq_res, 1, task))
3666 return; 3669 return;
@@ -3915,7 +3918,7 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
3915 return; 3918 return;
3916 } 3919 }
3917 calldata->timestamp = jiffies; 3920 calldata->timestamp = jiffies;
3918 if (nfs4_setup_sequence(calldata->server->nfs_client, 3921 if (nfs4_setup_sequence(calldata->server,
3919 &calldata->arg.seq_args, 3922 &calldata->arg.seq_args,
3920 &calldata->res.seq_res, 1, task)) 3923 &calldata->res.seq_res, 1, task))
3921 return; 3924 return;
@@ -4070,7 +4073,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
4070 } else 4073 } else
4071 data->arg.new_lock_owner = 0; 4074 data->arg.new_lock_owner = 0;
4072 data->timestamp = jiffies; 4075 data->timestamp = jiffies;
4073 if (nfs4_setup_sequence(data->server->nfs_client, &data->arg.seq_args, 4076 if (nfs4_setup_sequence(data->server,
4077 &data->arg.seq_args,
4074 &data->res.seq_res, 1, task)) 4078 &data->res.seq_res, 1, task))
4075 return; 4079 return;
4076 rpc_call_start(task); 4080 rpc_call_start(task);
@@ -5110,7 +5114,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data)
5110 args = task->tk_msg.rpc_argp; 5114 args = task->tk_msg.rpc_argp;
5111 res = task->tk_msg.rpc_resp; 5115 res = task->tk_msg.rpc_resp;
5112 5116
5113 if (nfs4_setup_sequence(clp, args, res, 0, task)) 5117 if (nfs41_setup_sequence(clp->cl_session, args, res, 0, task))
5114 return; 5118 return;
5115 rpc_call_start(task); 5119 rpc_call_start(task);
5116} 5120}
@@ -5195,7 +5199,8 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data)
5195 struct nfs4_reclaim_complete_data *calldata = data; 5199 struct nfs4_reclaim_complete_data *calldata = data;
5196 5200
5197 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); 5201 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
5198 if (nfs4_setup_sequence(calldata->clp, &calldata->arg.seq_args, 5202 if (nfs41_setup_sequence(calldata->clp->cl_session,
5203 &calldata->arg.seq_args,
5199 &calldata->res.seq_res, 0, task)) 5204 &calldata->res.seq_res, 0, task))
5200 return; 5205 return;
5201 5206