aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2013-08-09 12:48:27 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-09-03 15:26:32 -0400
commit9915ea7e0a83c0a4b94d0c5e05a9bb690fce809f (patch)
tree618778162a58afbc36b8231394308f82281262c5 /fs/nfs
parenta9c92d6b853547ceccb28594af3609ecaf35af6f (diff)
NFS: Add RPC callouts to start NFSv4.0 synchronous requests
Refactor nfs4_call_sync_sequence() so it is used for NFSv4.0 now. The RPC callouts will house transport blocking logic similar to NFSv4.1 sessions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4proc.c61
2 files changed, 42 insertions, 20 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 0feb23815e38..bf2184e65867 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -49,6 +49,7 @@ struct nfs4_minor_version_ops {
49 struct nfs_fsinfo *); 49 struct nfs_fsinfo *);
50 int (*free_lock_state)(struct nfs_server *, 50 int (*free_lock_state)(struct nfs_server *,
51 struct nfs4_lock_state *); 51 struct nfs4_lock_state *);
52 const struct rpc_call_ops *call_sync_ops;
52 const struct nfs4_state_recovery_ops *reboot_recovery_ops; 53 const struct nfs4_state_recovery_ops *reboot_recovery_ops;
53 const struct nfs4_state_recovery_ops *nograce_recovery_ops; 54 const struct nfs4_state_recovery_ops *nograce_recovery_ops;
54 const struct nfs4_state_maintenance_ops *state_renewal_ops; 55 const struct nfs4_state_maintenance_ops *state_renewal_ops;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7b702bc49419..2fbf4824187e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -741,6 +741,41 @@ static const struct rpc_call_ops nfs41_call_sync_ops = {
741 .rpc_call_done = nfs41_call_sync_done, 741 .rpc_call_done = nfs41_call_sync_done,
742}; 742};
743 743
744#else
745static int nfs4_setup_sequence(const struct nfs_server *server,
746 struct nfs4_sequence_args *args,
747 struct nfs4_sequence_res *res,
748 struct rpc_task *task)
749{
750 rpc_call_start(task);
751 return 0;
752}
753
754static int nfs4_sequence_done(struct rpc_task *task,
755 struct nfs4_sequence_res *res)
756{
757 return 1;
758}
759#endif /* CONFIG_NFS_V4_1 */
760
761static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata)
762{
763 struct nfs4_call_sync_data *data = calldata;
764 nfs4_setup_sequence(data->seq_server,
765 data->seq_args, data->seq_res, task);
766}
767
768static void nfs40_call_sync_done(struct rpc_task *task, void *calldata)
769{
770 struct nfs4_call_sync_data *data = calldata;
771 nfs4_sequence_done(task, data->seq_res);
772}
773
774static const struct rpc_call_ops nfs40_call_sync_ops = {
775 .rpc_call_prepare = nfs40_call_sync_prepare,
776 .rpc_call_done = nfs40_call_sync_done,
777};
778
744static int nfs4_call_sync_sequence(struct rpc_clnt *clnt, 779static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
745 struct nfs_server *server, 780 struct nfs_server *server,
746 struct rpc_message *msg, 781 struct rpc_message *msg,
@@ -749,6 +784,7 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
749{ 784{
750 int ret; 785 int ret;
751 struct rpc_task *task; 786 struct rpc_task *task;
787 struct nfs_client *clp = server->nfs_client;
752 struct nfs4_call_sync_data data = { 788 struct nfs4_call_sync_data data = {
753 .seq_server = server, 789 .seq_server = server,
754 .seq_args = args, 790 .seq_args = args,
@@ -757,7 +793,7 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
757 struct rpc_task_setup task_setup = { 793 struct rpc_task_setup task_setup = {
758 .rpc_client = clnt, 794 .rpc_client = clnt,
759 .rpc_message = msg, 795 .rpc_message = msg,
760 .callback_ops = &nfs41_call_sync_ops, 796 .callback_ops = clp->cl_mvops->call_sync_ops,
761 .callback_data = &data 797 .callback_data = &data
762 }; 798 };
763 799
@@ -771,23 +807,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
771 return ret; 807 return ret;
772} 808}
773 809
774#else
775static int nfs4_setup_sequence(const struct nfs_server *server,
776 struct nfs4_sequence_args *args,
777 struct nfs4_sequence_res *res,
778 struct rpc_task *task)
779{
780 rpc_call_start(task);
781 return 0;
782}
783
784static int nfs4_sequence_done(struct rpc_task *task,
785 struct nfs4_sequence_res *res)
786{
787 return 1;
788}
789#endif /* CONFIG_NFS_V4_1 */
790
791static 810static
792int _nfs4_call_sync(struct rpc_clnt *clnt, 811int _nfs4_call_sync(struct rpc_clnt *clnt,
793 struct nfs_server *server, 812 struct nfs_server *server,
@@ -807,8 +826,7 @@ int nfs4_call_sync(struct rpc_clnt *clnt,
807 int cache_reply) 826 int cache_reply)
808{ 827{
809 nfs4_init_sequence(args, res, cache_reply); 828 nfs4_init_sequence(args, res, cache_reply);
810 return server->nfs_client->cl_mvops->call_sync(clnt, server, msg, 829 return nfs4_call_sync_sequence(clnt, server, msg, args, res);
811 args, res);
812} 830}
813 831
814static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) 832static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
@@ -7529,6 +7547,7 @@ static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
7529 .match_stateid = nfs4_match_stateid, 7547 .match_stateid = nfs4_match_stateid,
7530 .find_root_sec = nfs4_find_root_sec, 7548 .find_root_sec = nfs4_find_root_sec,
7531 .free_lock_state = nfs4_release_lockowner, 7549 .free_lock_state = nfs4_release_lockowner,
7550 .call_sync_ops = &nfs40_call_sync_ops,
7532 .reboot_recovery_ops = &nfs40_reboot_recovery_ops, 7551 .reboot_recovery_ops = &nfs40_reboot_recovery_ops,
7533 .nograce_recovery_ops = &nfs40_nograce_recovery_ops, 7552 .nograce_recovery_ops = &nfs40_nograce_recovery_ops,
7534 .state_renewal_ops = &nfs40_state_renewal_ops, 7553 .state_renewal_ops = &nfs40_state_renewal_ops,
@@ -7547,6 +7566,7 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
7547 .match_stateid = nfs41_match_stateid, 7566 .match_stateid = nfs41_match_stateid,
7548 .find_root_sec = nfs41_find_root_sec, 7567 .find_root_sec = nfs41_find_root_sec,
7549 .free_lock_state = nfs41_free_lock_state, 7568 .free_lock_state = nfs41_free_lock_state,
7569 .call_sync_ops = &nfs41_call_sync_ops,
7550 .reboot_recovery_ops = &nfs41_reboot_recovery_ops, 7570 .reboot_recovery_ops = &nfs41_reboot_recovery_ops,
7551 .nograce_recovery_ops = &nfs41_nograce_recovery_ops, 7571 .nograce_recovery_ops = &nfs41_nograce_recovery_ops,
7552 .state_renewal_ops = &nfs41_state_renewal_ops, 7572 .state_renewal_ops = &nfs41_state_renewal_ops,
@@ -7566,6 +7586,7 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
7566 .match_stateid = nfs41_match_stateid, 7586 .match_stateid = nfs41_match_stateid,
7567 .find_root_sec = nfs41_find_root_sec, 7587 .find_root_sec = nfs41_find_root_sec,
7568 .free_lock_state = nfs41_free_lock_state, 7588 .free_lock_state = nfs41_free_lock_state,
7589 .call_sync_ops = &nfs41_call_sync_ops,
7569 .reboot_recovery_ops = &nfs41_reboot_recovery_ops, 7590 .reboot_recovery_ops = &nfs41_reboot_recovery_ops,
7570 .nograce_recovery_ops = &nfs41_nograce_recovery_ops, 7591 .nograce_recovery_ops = &nfs41_nograce_recovery_ops,
7571 .state_renewal_ops = &nfs41_state_renewal_ops, 7592 .state_renewal_ops = &nfs41_state_renewal_ops,