aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-17 22:04:25 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 19:28:06 -0500
commit9d12b216aa87f68c96f6dd8eb5d2d0ccc9989b1c (patch)
tree74dbe1f8b150b3a66f5cb3589e5efd51ad9dfff5 /fs
parentd2d7ce28a2f8ec6ca2a49145e643d2e3c7d21ba3 (diff)
NFSv41: Add a new helper nfs4_init_sequence()
Clean up Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4_fs.h6
-rw-r--r--fs/nfs/nfs4filelayout.c4
-rw-r--r--fs/nfs/nfs4proc.c93
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/unlink.c4
-rw-r--r--fs/nfs/write.c2
6 files changed, 65 insertions, 46 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b23cb0cda632..0924494e10a2 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -230,10 +230,10 @@ static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *ser
230 230
231extern int nfs4_setup_sequence(const struct nfs_server *server, 231extern int nfs4_setup_sequence(const struct nfs_server *server,
232 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 232 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
233 int cache_reply, struct rpc_task *task); 233 struct rpc_task *task);
234extern int nfs41_setup_sequence(struct nfs4_session *session, 234extern int nfs41_setup_sequence(struct nfs4_session *session,
235 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 235 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
236 int cache_reply, struct rpc_task *task); 236 struct rpc_task *task);
237extern void nfs4_destroy_session(struct nfs4_session *session); 237extern void nfs4_destroy_session(struct nfs4_session *session);
238extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); 238extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp);
239extern int nfs4_proc_create_session(struct nfs_client *); 239extern int nfs4_proc_create_session(struct nfs_client *);
@@ -264,7 +264,7 @@ static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *ser
264 264
265static inline int nfs4_setup_sequence(const struct nfs_server *server, 265static inline int nfs4_setup_sequence(const struct nfs_server *server,
266 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 266 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
267 int cache_reply, struct rpc_task *task) 267 struct rpc_task *task)
268{ 268{
269 return 0; 269 return 0;
270} 270}
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 71ec08617e23..b4f8f9624afa 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -173,7 +173,7 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
173 173
174 if (nfs41_setup_sequence(rdata->ds_clp->cl_session, 174 if (nfs41_setup_sequence(rdata->ds_clp->cl_session,
175 &rdata->args.seq_args, &rdata->res.seq_res, 175 &rdata->args.seq_args, &rdata->res.seq_res,
176 0, task)) 176 task))
177 return; 177 return;
178 178
179 rpc_call_start(task); 179 rpc_call_start(task);
@@ -254,7 +254,7 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
254 254
255 if (nfs41_setup_sequence(wdata->ds_clp->cl_session, 255 if (nfs41_setup_sequence(wdata->ds_clp->cl_session,
256 &wdata->args.seq_args, &wdata->res.seq_res, 256 &wdata->args.seq_args, &wdata->res.seq_res,
257 0, task)) 257 task))
258 return; 258 return;
259 259
260 rpc_call_start(task); 260 rpc_call_start(task);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9c77af900960..8926d33383ed 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -534,10 +534,20 @@ out:
534 return ret_id; 534 return ret_id;
535} 535}
536 536
537static void nfs41_init_sequence(struct nfs4_sequence_args *args,
538 struct nfs4_sequence_res *res, int cache_reply)
539{
540 args->sa_session = NULL;
541 args->sa_cache_this = 0;
542 if (cache_reply)
543 args->sa_cache_this = 1;
544 res->sr_session = NULL;
545 res->sr_slot = NULL;
546}
547
537int nfs41_setup_sequence(struct nfs4_session *session, 548int nfs41_setup_sequence(struct nfs4_session *session,
538 struct nfs4_sequence_args *args, 549 struct nfs4_sequence_args *args,
539 struct nfs4_sequence_res *res, 550 struct nfs4_sequence_res *res,
540 int cache_reply,
541 struct rpc_task *task) 551 struct rpc_task *task)
542{ 552{
543 struct nfs4_slot *slot; 553 struct nfs4_slot *slot;
@@ -582,7 +592,6 @@ int nfs41_setup_sequence(struct nfs4_session *session,
582 slot = tbl->slots + slotid; 592 slot = tbl->slots + slotid;
583 args->sa_session = session; 593 args->sa_session = session;
584 args->sa_slotid = slotid; 594 args->sa_slotid = slotid;
585 args->sa_cache_this = cache_reply;
586 595
587 dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr); 596 dprintk("<-- %s slotid=%d seqid=%d\n", __func__, slotid, slot->seq_nr);
588 597
@@ -602,24 +611,19 @@ EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
602int nfs4_setup_sequence(const struct nfs_server *server, 611int nfs4_setup_sequence(const struct nfs_server *server,
603 struct nfs4_sequence_args *args, 612 struct nfs4_sequence_args *args,
604 struct nfs4_sequence_res *res, 613 struct nfs4_sequence_res *res,
605 int cache_reply,
606 struct rpc_task *task) 614 struct rpc_task *task)
607{ 615{
608 struct nfs4_session *session = nfs4_get_session(server); 616 struct nfs4_session *session = nfs4_get_session(server);
609 int ret = 0; 617 int ret = 0;
610 618
611 if (session == NULL) { 619 if (session == NULL)
612 args->sa_session = NULL;
613 res->sr_session = NULL;
614 goto out; 620 goto out;
615 }
616 621
617 dprintk("--> %s clp %p session %p sr_slot %td\n", 622 dprintk("--> %s clp %p session %p sr_slot %td\n",
618 __func__, session->clp, session, res->sr_slot ? 623 __func__, session->clp, session, res->sr_slot ?
619 res->sr_slot - session->fc_slot_table.slots : -1); 624 res->sr_slot - session->fc_slot_table.slots : -1);
620 625
621 ret = nfs41_setup_sequence(session, args, res, cache_reply, 626 ret = nfs41_setup_sequence(session, args, res, task);
622 task);
623out: 627out:
624 dprintk("<-- %s status=%d\n", __func__, ret); 628 dprintk("<-- %s status=%d\n", __func__, ret);
625 return ret; 629 return ret;
@@ -629,7 +633,6 @@ struct nfs41_call_sync_data {
629 const struct nfs_server *seq_server; 633 const struct nfs_server *seq_server;
630 struct nfs4_sequence_args *seq_args; 634 struct nfs4_sequence_args *seq_args;
631 struct nfs4_sequence_res *seq_res; 635 struct nfs4_sequence_res *seq_res;
632 int cache_reply;
633}; 636};
634 637
635static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) 638static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
@@ -639,7 +642,7 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
639 dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server); 642 dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server);
640 643
641 if (nfs4_setup_sequence(data->seq_server, data->seq_args, 644 if (nfs4_setup_sequence(data->seq_server, data->seq_args,
642 data->seq_res, data->cache_reply, task)) 645 data->seq_res, task))
643 return; 646 return;
644 rpc_call_start(task); 647 rpc_call_start(task);
645} 648}
@@ -672,7 +675,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
672 struct rpc_message *msg, 675 struct rpc_message *msg,
673 struct nfs4_sequence_args *args, 676 struct nfs4_sequence_args *args,
674 struct nfs4_sequence_res *res, 677 struct nfs4_sequence_res *res,
675 int cache_reply,
676 int privileged) 678 int privileged)
677{ 679{
678 int ret; 680 int ret;
@@ -681,7 +683,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
681 .seq_server = server, 683 .seq_server = server,
682 .seq_args = args, 684 .seq_args = args,
683 .seq_res = res, 685 .seq_res = res,
684 .cache_reply = cache_reply,
685 }; 686 };
686 struct rpc_task_setup task_setup = { 687 struct rpc_task_setup task_setup = {
687 .rpc_client = clnt, 688 .rpc_client = clnt,
@@ -690,7 +691,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
690 .callback_data = &data 691 .callback_data = &data
691 }; 692 };
692 693
693 res->sr_slot = NULL;
694 if (privileged) 694 if (privileged)
695 task_setup.callback_ops = &nfs41_call_priv_sync_ops; 695 task_setup.callback_ops = &nfs41_call_priv_sync_ops;
696 task = rpc_run_task(&task_setup); 696 task = rpc_run_task(&task_setup);
@@ -710,10 +710,17 @@ int _nfs4_call_sync_session(struct rpc_clnt *clnt,
710 struct nfs4_sequence_res *res, 710 struct nfs4_sequence_res *res,
711 int cache_reply) 711 int cache_reply)
712{ 712{
713 return nfs4_call_sync_sequence(clnt, server, msg, args, res, cache_reply, 0); 713 nfs41_init_sequence(args, res, cache_reply);
714 return nfs4_call_sync_sequence(clnt, server, msg, args, res, 0);
714} 715}
715 716
716#else 717#else
718static inline
719void nfs41_init_sequence(struct nfs4_sequence_args *args,
720 struct nfs4_sequence_res *res, int cache_reply)
721{
722}
723
717static int nfs4_sequence_done(struct rpc_task *task, 724static int nfs4_sequence_done(struct rpc_task *task,
718 struct nfs4_sequence_res *res) 725 struct nfs4_sequence_res *res)
719{ 726{
@@ -728,7 +735,7 @@ int _nfs4_call_sync(struct rpc_clnt *clnt,
728 struct nfs4_sequence_res *res, 735 struct nfs4_sequence_res *res,
729 int cache_reply) 736 int cache_reply)
730{ 737{
731 args->sa_session = res->sr_session = NULL; 738 nfs41_init_sequence(args, res, cache_reply);
732 return rpc_call_sync(clnt, msg, 0); 739 return rpc_call_sync(clnt, msg, 0);
733} 740}
734 741
@@ -1449,7 +1456,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
1449 data->timestamp = jiffies; 1456 data->timestamp = jiffies;
1450 if (nfs4_setup_sequence(data->o_arg.server, 1457 if (nfs4_setup_sequence(data->o_arg.server,
1451 &data->o_arg.seq_args, 1458 &data->o_arg.seq_args,
1452 &data->o_res.seq_res, 1, task)) 1459 &data->o_res.seq_res, task))
1453 return; 1460 return;
1454 rpc_call_start(task); 1461 rpc_call_start(task);
1455 return; 1462 return;
@@ -1551,6 +1558,7 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover)
1551 }; 1558 };
1552 int status; 1559 int status;
1553 1560
1561 nfs41_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1);
1554 kref_get(&data->kref); 1562 kref_get(&data->kref);
1555 data->rpc_done = 0; 1563 data->rpc_done = 0;
1556 data->rpc_status = 0; 1564 data->rpc_status = 0;
@@ -2030,8 +2038,9 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
2030 nfs_fattr_init(calldata->res.fattr); 2038 nfs_fattr_init(calldata->res.fattr);
2031 calldata->timestamp = jiffies; 2039 calldata->timestamp = jiffies;
2032 if (nfs4_setup_sequence(NFS_SERVER(calldata->inode), 2040 if (nfs4_setup_sequence(NFS_SERVER(calldata->inode),
2033 &calldata->arg.seq_args, &calldata->res.seq_res, 2041 &calldata->arg.seq_args,
2034 1, task)) 2042 &calldata->res.seq_res,
2043 task))
2035 return; 2044 return;
2036 rpc_call_start(task); 2045 rpc_call_start(task);
2037} 2046}
@@ -2075,6 +2084,7 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc)
2075 calldata = kzalloc(sizeof(*calldata), gfp_mask); 2084 calldata = kzalloc(sizeof(*calldata), gfp_mask);
2076 if (calldata == NULL) 2085 if (calldata == NULL)
2077 goto out; 2086 goto out;
2087 nfs41_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 1);
2078 calldata->inode = state->inode; 2088 calldata->inode = state->inode;
2079 calldata->state = state; 2089 calldata->state = state;
2080 calldata->arg.fh = NFS_FH(state->inode); 2090 calldata->arg.fh = NFS_FH(state->inode);
@@ -2713,8 +2723,8 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
2713 2723
2714 args->bitmask = server->cache_consistency_bitmask; 2724 args->bitmask = server->cache_consistency_bitmask;
2715 res->server = server; 2725 res->server = server;
2716 res->seq_res.sr_slot = NULL;
2717 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE]; 2726 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
2727 nfs41_init_sequence(&args->seq_args, &res->seq_res, 1);
2718} 2728}
2719 2729
2720static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) 2730static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
@@ -2739,6 +2749,7 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
2739 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME]; 2749 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME];
2740 arg->bitmask = server->attr_bitmask; 2750 arg->bitmask = server->attr_bitmask;
2741 res->server = server; 2751 res->server = server;
2752 nfs41_init_sequence(&arg->seq_args, &res->seq_res, 1);
2742} 2753}
2743 2754
2744static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir, 2755static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
@@ -3233,6 +3244,7 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
3233 data->timestamp = jiffies; 3244 data->timestamp = jiffies;
3234 data->read_done_cb = nfs4_read_done_cb; 3245 data->read_done_cb = nfs4_read_done_cb;
3235 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ]; 3246 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
3247 nfs41_init_sequence(&data->args.seq_args, &data->res.seq_res, 0);
3236} 3248}
3237 3249
3238/* Reset the the nfs_read_data to send the read to the MDS. */ 3250/* Reset the the nfs_read_data to send the read to the MDS. */
@@ -3306,6 +3318,7 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag
3306 data->timestamp = jiffies; 3318 data->timestamp = jiffies;
3307 3319
3308 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE]; 3320 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE];
3321 nfs41_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
3309} 3322}
3310 3323
3311static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_write_data *data) 3324static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_write_data *data)
@@ -3340,6 +3353,7 @@ static void nfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_messa
3340 data->write_done_cb = nfs4_commit_done_cb; 3353 data->write_done_cb = nfs4_commit_done_cb;
3341 data->res.server = server; 3354 data->res.server = server;
3342 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT]; 3355 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT];
3356 nfs41_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
3343} 3357}
3344 3358
3345struct nfs4_renewdata { 3359struct nfs4_renewdata {
@@ -3892,7 +3906,7 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data)
3892 3906
3893 if (nfs4_setup_sequence(d_data->res.server, 3907 if (nfs4_setup_sequence(d_data->res.server,
3894 &d_data->args.seq_args, 3908 &d_data->args.seq_args,
3895 &d_data->res.seq_res, 1, task)) 3909 &d_data->res.seq_res, task))
3896 return; 3910 return;
3897 rpc_call_start(task); 3911 rpc_call_start(task);
3898} 3912}
@@ -3926,6 +3940,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
3926 data = kzalloc(sizeof(*data), GFP_NOFS); 3940 data = kzalloc(sizeof(*data), GFP_NOFS);
3927 if (data == NULL) 3941 if (data == NULL)
3928 return -ENOMEM; 3942 return -ENOMEM;
3943 nfs41_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
3929 data->args.fhandle = &data->fh; 3944 data->args.fhandle = &data->fh;
3930 data->args.stateid = &data->stateid; 3945 data->args.stateid = &data->stateid;
3931 data->args.bitmask = server->attr_bitmask; 3946 data->args.bitmask = server->attr_bitmask;
@@ -4143,7 +4158,7 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
4143 calldata->timestamp = jiffies; 4158 calldata->timestamp = jiffies;
4144 if (nfs4_setup_sequence(calldata->server, 4159 if (nfs4_setup_sequence(calldata->server,
4145 &calldata->arg.seq_args, 4160 &calldata->arg.seq_args,
4146 &calldata->res.seq_res, 1, task)) 4161 &calldata->res.seq_res, task))
4147 return; 4162 return;
4148 rpc_call_start(task); 4163 rpc_call_start(task);
4149} 4164}
@@ -4183,6 +4198,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
4183 return ERR_PTR(-ENOMEM); 4198 return ERR_PTR(-ENOMEM);
4184 } 4199 }
4185 4200
4201 nfs41_init_sequence(&data->arg.seq_args, &data->res.seq_res, 1);
4186 msg.rpc_argp = &data->arg; 4202 msg.rpc_argp = &data->arg;
4187 msg.rpc_resp = &data->res; 4203 msg.rpc_resp = &data->res;
4188 task_setup_data.callback_data = data; 4204 task_setup_data.callback_data = data;
@@ -4298,7 +4314,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
4298 data->timestamp = jiffies; 4314 data->timestamp = jiffies;
4299 if (nfs4_setup_sequence(data->server, 4315 if (nfs4_setup_sequence(data->server,
4300 &data->arg.seq_args, 4316 &data->arg.seq_args,
4301 &data->res.seq_res, 1, task)) 4317 &data->res.seq_res, task))
4302 return; 4318 return;
4303 rpc_call_start(task); 4319 rpc_call_start(task);
4304 dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status); 4320 dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status);
@@ -4416,6 +4432,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
4416 data->arg.reclaim = NFS_LOCK_RECLAIM; 4432 data->arg.reclaim = NFS_LOCK_RECLAIM;
4417 task_setup_data.callback_ops = &nfs4_recover_lock_ops; 4433 task_setup_data.callback_ops = &nfs4_recover_lock_ops;
4418 } 4434 }
4435 nfs41_init_sequence(&data->arg.seq_args, &data->res.seq_res, 1);
4419 msg.rpc_argp = &data->arg; 4436 msg.rpc_argp = &data->arg;
4420 msg.rpc_resp = &data->res; 4437 msg.rpc_resp = &data->res;
4421 task_setup_data.callback_data = data; 4438 task_setup_data.callback_data = data;
@@ -4931,7 +4948,7 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task,
4931 since we're invoked within one */ 4948 since we're invoked within one */
4932 ret = nfs41_setup_sequence(data->clp->cl_session, 4949 ret = nfs41_setup_sequence(data->clp->cl_session,
4933 &data->args->la_seq_args, 4950 &data->args->la_seq_args,
4934 &data->res->lr_seq_res, 0, task); 4951 &data->res->lr_seq_res, task);
4935 4952
4936 BUG_ON(ret == -EAGAIN); 4953 BUG_ON(ret == -EAGAIN);
4937 rpc_call_start(task); 4954 rpc_call_start(task);
@@ -4995,6 +5012,7 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
4995 }; 5012 };
4996 int status; 5013 int status;
4997 5014
5015 nfs41_init_sequence(&args.la_seq_args, &res.lr_seq_res, 0);
4998 dprintk("--> %s\n", __func__); 5016 dprintk("--> %s\n", __func__);
4999 task = rpc_run_task(&task_setup); 5017 task = rpc_run_task(&task_setup);
5000 5018
@@ -5468,7 +5486,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data)
5468 args = task->tk_msg.rpc_argp; 5486 args = task->tk_msg.rpc_argp;
5469 res = task->tk_msg.rpc_resp; 5487 res = task->tk_msg.rpc_resp;
5470 5488
5471 if (nfs41_setup_sequence(clp->cl_session, args, res, 0, task)) 5489 if (nfs41_setup_sequence(clp->cl_session, args, res, task))
5472 return; 5490 return;
5473 rpc_call_start(task); 5491 rpc_call_start(task);
5474} 5492}
@@ -5500,6 +5518,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_
5500 nfs_put_client(clp); 5518 nfs_put_client(clp);
5501 return ERR_PTR(-ENOMEM); 5519 return ERR_PTR(-ENOMEM);
5502 } 5520 }
5521 nfs41_init_sequence(&calldata->args, &calldata->res, 0);
5503 msg.rpc_argp = &calldata->args; 5522 msg.rpc_argp = &calldata->args;
5504 msg.rpc_resp = &calldata->res; 5523 msg.rpc_resp = &calldata->res;
5505 calldata->clp = clp; 5524 calldata->clp = clp;
@@ -5561,7 +5580,7 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data)
5561 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); 5580 rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
5562 if (nfs41_setup_sequence(calldata->clp->cl_session, 5581 if (nfs41_setup_sequence(calldata->clp->cl_session,
5563 &calldata->arg.seq_args, 5582 &calldata->arg.seq_args,
5564 &calldata->res.seq_res, 0, task)) 5583 &calldata->res.seq_res, task))
5565 return; 5584 return;
5566 5585
5567 rpc_call_start(task); 5586 rpc_call_start(task);
@@ -5640,6 +5659,7 @@ static int nfs41_proc_reclaim_complete(struct nfs_client *clp)
5640 calldata->clp = clp; 5659 calldata->clp = clp;
5641 calldata->arg.one_fs = 0; 5660 calldata->arg.one_fs = 0;
5642 5661
5662 nfs41_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 0);
5643 msg.rpc_argp = &calldata->arg; 5663 msg.rpc_argp = &calldata->arg;
5644 msg.rpc_resp = &calldata->res; 5664 msg.rpc_resp = &calldata->res;
5645 task_setup_data.callback_data = calldata; 5665 task_setup_data.callback_data = calldata;
@@ -5671,7 +5691,7 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
5671 * to be no way to prevent it completely. 5691 * to be no way to prevent it completely.
5672 */ 5692 */
5673 if (nfs4_setup_sequence(server, &lgp->args.seq_args, 5693 if (nfs4_setup_sequence(server, &lgp->args.seq_args,
5674 &lgp->res.seq_res, 0, task)) 5694 &lgp->res.seq_res, task))
5675 return; 5695 return;
5676 if (pnfs_choose_layoutget_stateid(&lgp->args.stateid, 5696 if (pnfs_choose_layoutget_stateid(&lgp->args.stateid,
5677 NFS_I(lgp->args.inode)->layout, 5697 NFS_I(lgp->args.inode)->layout,
@@ -5746,6 +5766,7 @@ int nfs4_proc_layoutget(struct nfs4_layoutget *lgp)
5746 5766
5747 lgp->res.layoutp = &lgp->args.layout; 5767 lgp->res.layoutp = &lgp->args.layout;
5748 lgp->res.seq_res.sr_slot = NULL; 5768 lgp->res.seq_res.sr_slot = NULL;
5769 nfs41_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0);
5749 task = rpc_run_task(&task_setup_data); 5770 task = rpc_run_task(&task_setup_data);
5750 if (IS_ERR(task)) 5771 if (IS_ERR(task))
5751 return PTR_ERR(task); 5772 return PTR_ERR(task);
@@ -5766,7 +5787,7 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
5766 5787
5767 dprintk("--> %s\n", __func__); 5788 dprintk("--> %s\n", __func__);
5768 if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args, 5789 if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args,
5769 &lrp->res.seq_res, 0, task)) 5790 &lrp->res.seq_res, task))
5770 return; 5791 return;
5771 rpc_call_start(task); 5792 rpc_call_start(task);
5772} 5793}
@@ -5832,6 +5853,7 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp)
5832 int status; 5853 int status;
5833 5854
5834 dprintk("--> %s\n", __func__); 5855 dprintk("--> %s\n", __func__);
5856 nfs41_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1);
5835 task = rpc_run_task(&task_setup_data); 5857 task = rpc_run_task(&task_setup_data);
5836 if (IS_ERR(task)) 5858 if (IS_ERR(task))
5837 return PTR_ERR(task); 5859 return PTR_ERR(task);
@@ -5932,7 +5954,7 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata)
5932 struct nfs_server *server = NFS_SERVER(data->args.inode); 5954 struct nfs_server *server = NFS_SERVER(data->args.inode);
5933 5955
5934 if (nfs4_setup_sequence(server, &data->args.seq_args, 5956 if (nfs4_setup_sequence(server, &data->args.seq_args,
5935 &data->res.seq_res, 1, task)) 5957 &data->res.seq_res, task))
5936 return; 5958 return;
5937 rpc_call_start(task); 5959 rpc_call_start(task);
5938} 5960}
@@ -6019,6 +6041,7 @@ nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, bool sync)
6019 data->args.lastbytewritten, 6041 data->args.lastbytewritten,
6020 data->args.inode->i_ino); 6042 data->args.inode->i_ino);
6021 6043
6044 nfs41_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
6022 task = rpc_run_task(&task_setup_data); 6045 task = rpc_run_task(&task_setup_data);
6023 if (IS_ERR(task)) 6046 if (IS_ERR(task))
6024 return PTR_ERR(task); 6047 return PTR_ERR(task);
@@ -6114,7 +6137,6 @@ out:
6114} 6137}
6115static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state) 6138static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state)
6116{ 6139{
6117 int status;
6118 struct nfs41_test_stateid_args args = { 6140 struct nfs41_test_stateid_args args = {
6119 .stateid = &state->stateid, 6141 .stateid = &state->stateid,
6120 }; 6142 };
@@ -6124,9 +6146,8 @@ static int _nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *sta
6124 .rpc_argp = &args, 6146 .rpc_argp = &args,
6125 .rpc_resp = &res, 6147 .rpc_resp = &res,
6126 }; 6148 };
6127 args.seq_args.sa_session = res.seq_res.sr_session = NULL; 6149 nfs41_init_sequence(&args.seq_args, &res.seq_res, 0);
6128 status = nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 1); 6150 return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
6129 return status;
6130} 6151}
6131 6152
6132static int nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state) 6153static int nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *state)
@@ -6143,7 +6164,6 @@ static int nfs41_test_stateid(struct nfs_server *server, struct nfs4_state *stat
6143 6164
6144static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *state) 6165static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *state)
6145{ 6166{
6146 int status;
6147 struct nfs41_free_stateid_args args = { 6167 struct nfs41_free_stateid_args args = {
6148 .stateid = &state->stateid, 6168 .stateid = &state->stateid,
6149 }; 6169 };
@@ -6154,9 +6174,8 @@ static int _nfs4_free_stateid(struct nfs_server *server, struct nfs4_state *stat
6154 .rpc_resp = &res, 6174 .rpc_resp = &res,
6155 }; 6175 };
6156 6176
6157 args.seq_args.sa_session = res.seq_res.sr_session = NULL; 6177 nfs41_init_sequence(&args.seq_args, &res.seq_res, 0);
6158 status = nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 1); 6178 return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
6159 return status;
6160} 6179}
6161 6180
6162static int nfs41_free_stateid(struct nfs_server *server, struct nfs4_state *state) 6181static int nfs41_free_stateid(struct nfs_server *server, struct nfs4_state *state)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index cfa175c223dc..3c2540d532c7 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -472,7 +472,7 @@ void nfs_read_prepare(struct rpc_task *task, void *calldata)
472 472
473 if (nfs4_setup_sequence(NFS_SERVER(data->inode), 473 if (nfs4_setup_sequence(NFS_SERVER(data->inode),
474 &data->args.seq_args, &data->res.seq_res, 474 &data->args.seq_args, &data->res.seq_res,
475 0, task)) 475 task))
476 return; 476 return;
477 rpc_call_start(task); 477 rpc_call_start(task);
478} 478}
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 4f9319a2e567..490613b709b6 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -114,7 +114,7 @@ void nfs_unlink_prepare(struct rpc_task *task, void *calldata)
114 struct nfs_server *server = NFS_SERVER(data->dir); 114 struct nfs_server *server = NFS_SERVER(data->dir);
115 115
116 if (nfs4_setup_sequence(server, &data->args.seq_args, 116 if (nfs4_setup_sequence(server, &data->args.seq_args,
117 &data->res.seq_res, 1, task)) 117 &data->res.seq_res, task))
118 return; 118 return;
119 rpc_call_start(task); 119 rpc_call_start(task);
120} 120}
@@ -410,7 +410,7 @@ static void nfs_rename_prepare(struct rpc_task *task, void *calldata)
410 struct nfs_server *server = NFS_SERVER(data->old_dir); 410 struct nfs_server *server = NFS_SERVER(data->old_dir);
411 411
412 if (nfs4_setup_sequence(server, &data->args.seq_args, 412 if (nfs4_setup_sequence(server, &data->args.seq_args,
413 &data->res.seq_res, 1, task)) 413 &data->res.seq_res, task))
414 return; 414 return;
415 rpc_call_start(task); 415 rpc_call_start(task);
416} 416}
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 834f0fe96f89..0b1831d95849 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1135,7 +1135,7 @@ void nfs_write_prepare(struct rpc_task *task, void *calldata)
1135 1135
1136 if (nfs4_setup_sequence(NFS_SERVER(data->inode), 1136 if (nfs4_setup_sequence(NFS_SERVER(data->inode),
1137 &data->args.seq_args, 1137 &data->args.seq_args,
1138 &data->res.seq_res, 1, task)) 1138 &data->res.seq_res, task))
1139 return; 1139 return;
1140 rpc_call_start(task); 1140 rpc_call_start(task);
1141} 1141}