aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/direct.c1
-rw-r--r--fs/nfs/nfs3proc.c44
-rw-r--r--fs/nfs/nfs4proc.c107
-rw-r--r--fs/nfs/proc.c28
-rw-r--r--fs/nfs/read.c10
-rw-r--r--fs/nfs/unlink.c19
-rw-r--r--fs/nfs/write.c21
7 files changed, 126 insertions, 104 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 079228817603..a834423942c7 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -269,7 +269,6 @@ static void nfs_direct_read_schedule(struct nfs_direct_req *dreq,
269 269
270 data->task.tk_cookie = (unsigned long) inode; 270 data->task.tk_cookie = (unsigned long) inode;
271 data->task.tk_calldata = data; 271 data->task.tk_calldata = data;
272 data->task.tk_release = nfs_readdata_release;
273 data->complete = nfs_direct_read_result; 272 data->complete = nfs_direct_read_result;
274 273
275 lock_kernel(); 274 lock_kernel();
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 92c870d19ccd..c172a7584646 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -732,19 +732,23 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
732 732
733extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); 733extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int);
734 734
735static void 735static void nfs3_read_done(struct rpc_task *task, void *calldata)
736nfs3_read_done(struct rpc_task *task)
737{ 736{
738 struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; 737 struct nfs_read_data *data = calldata;
739 738
740 if (nfs3_async_handle_jukebox(task)) 739 if (nfs3_async_handle_jukebox(task))
741 return; 740 return;
742 /* Call back common NFS readpage processing */ 741 /* Call back common NFS readpage processing */
743 if (task->tk_status >= 0) 742 if (task->tk_status >= 0)
744 nfs_refresh_inode(data->inode, &data->fattr); 743 nfs_refresh_inode(data->inode, &data->fattr);
745 nfs_readpage_result(task); 744 nfs_readpage_result(task, calldata);
746} 745}
747 746
747static const struct rpc_call_ops nfs3_read_ops = {
748 .rpc_call_done = nfs3_read_done,
749 .rpc_release = nfs_readdata_release,
750};
751
748static void 752static void
749nfs3_proc_read_setup(struct nfs_read_data *data) 753nfs3_proc_read_setup(struct nfs_read_data *data)
750{ 754{
@@ -762,23 +766,26 @@ nfs3_proc_read_setup(struct nfs_read_data *data)
762 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); 766 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
763 767
764 /* Finalize the task. */ 768 /* Finalize the task. */
765 rpc_init_task(task, NFS_CLIENT(inode), nfs3_read_done, flags); 769 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_read_ops, data);
766 rpc_call_setup(task, &msg, 0); 770 rpc_call_setup(task, &msg, 0);
767} 771}
768 772
769static void 773static void nfs3_write_done(struct rpc_task *task, void *calldata)
770nfs3_write_done(struct rpc_task *task)
771{ 774{
772 struct nfs_write_data *data; 775 struct nfs_write_data *data = calldata;
773 776
774 if (nfs3_async_handle_jukebox(task)) 777 if (nfs3_async_handle_jukebox(task))
775 return; 778 return;
776 data = (struct nfs_write_data *)task->tk_calldata;
777 if (task->tk_status >= 0) 779 if (task->tk_status >= 0)
778 nfs_post_op_update_inode(data->inode, data->res.fattr); 780 nfs_post_op_update_inode(data->inode, data->res.fattr);
779 nfs_writeback_done(task); 781 nfs_writeback_done(task, calldata);
780} 782}
781 783
784static const struct rpc_call_ops nfs3_write_ops = {
785 .rpc_call_done = nfs3_write_done,
786 .rpc_release = nfs_writedata_release,
787};
788
782static void 789static void
783nfs3_proc_write_setup(struct nfs_write_data *data, int how) 790nfs3_proc_write_setup(struct nfs_write_data *data, int how)
784{ 791{
@@ -806,23 +813,26 @@ nfs3_proc_write_setup(struct nfs_write_data *data, int how)
806 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 813 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
807 814
808 /* Finalize the task. */ 815 /* Finalize the task. */
809 rpc_init_task(task, NFS_CLIENT(inode), nfs3_write_done, flags); 816 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_write_ops, data);
810 rpc_call_setup(task, &msg, 0); 817 rpc_call_setup(task, &msg, 0);
811} 818}
812 819
813static void 820static void nfs3_commit_done(struct rpc_task *task, void *calldata)
814nfs3_commit_done(struct rpc_task *task)
815{ 821{
816 struct nfs_write_data *data; 822 struct nfs_write_data *data = calldata;
817 823
818 if (nfs3_async_handle_jukebox(task)) 824 if (nfs3_async_handle_jukebox(task))
819 return; 825 return;
820 data = (struct nfs_write_data *)task->tk_calldata;
821 if (task->tk_status >= 0) 826 if (task->tk_status >= 0)
822 nfs_post_op_update_inode(data->inode, data->res.fattr); 827 nfs_post_op_update_inode(data->inode, data->res.fattr);
823 nfs_commit_done(task); 828 nfs_commit_done(task, calldata);
824} 829}
825 830
831static const struct rpc_call_ops nfs3_commit_ops = {
832 .rpc_call_done = nfs3_commit_done,
833 .rpc_release = nfs_commit_release,
834};
835
826static void 836static void
827nfs3_proc_commit_setup(struct nfs_write_data *data, int how) 837nfs3_proc_commit_setup(struct nfs_write_data *data, int how)
828{ 838{
@@ -840,7 +850,7 @@ nfs3_proc_commit_setup(struct nfs_write_data *data, int how)
840 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 850 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
841 851
842 /* Finalize the task. */ 852 /* Finalize the task. */
843 rpc_init_task(task, NFS_CLIENT(inode), nfs3_commit_done, flags); 853 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs3_commit_ops, data);
844 rpc_call_setup(task, &msg, 0); 854 rpc_call_setup(task, &msg, 0);
845} 855}
846 856
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f988a9417b13..3d5d3c07d621 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -196,14 +196,12 @@ static void update_changeattr(struct inode *inode, struct nfs4_change_info *cinf
196 196
197/* Helper for asynchronous RPC calls */ 197/* Helper for asynchronous RPC calls */
198static int nfs4_call_async(struct rpc_clnt *clnt, rpc_action tk_begin, 198static int nfs4_call_async(struct rpc_clnt *clnt, rpc_action tk_begin,
199 rpc_action tk_exit, void *calldata) 199 const struct rpc_call_ops *tk_ops, void *calldata)
200{ 200{
201 struct rpc_task *task; 201 struct rpc_task *task;
202 202
203 if (!(task = rpc_new_task(clnt, tk_exit, RPC_TASK_ASYNC))) 203 if (!(task = rpc_new_task(clnt, RPC_TASK_ASYNC, tk_ops, calldata)))
204 return -ENOMEM; 204 return -ENOMEM;
205
206 task->tk_calldata = calldata;
207 task->tk_action = tk_begin; 205 task->tk_action = tk_begin;
208 rpc_execute(task); 206 rpc_execute(task);
209 return 0; 207 return 0;
@@ -867,10 +865,10 @@ struct nfs4_closedata {
867 struct nfs_fattr fattr; 865 struct nfs_fattr fattr;
868}; 866};
869 867
870static void nfs4_free_closedata(struct nfs4_closedata *calldata) 868static void nfs4_free_closedata(void *data)
871{ 869{
872 struct nfs4_state *state = calldata->state; 870 struct nfs4_closedata *calldata = data;
873 struct nfs4_state_owner *sp = state->owner; 871 struct nfs4_state_owner *sp = calldata->state->owner;
874 872
875 nfs4_put_open_state(calldata->state); 873 nfs4_put_open_state(calldata->state);
876 nfs_free_seqid(calldata->arg.seqid); 874 nfs_free_seqid(calldata->arg.seqid);
@@ -878,9 +876,9 @@ static void nfs4_free_closedata(struct nfs4_closedata *calldata)
878 kfree(calldata); 876 kfree(calldata);
879} 877}
880 878
881static void nfs4_close_done(struct rpc_task *task) 879static void nfs4_close_done(struct rpc_task *task, void *data)
882{ 880{
883 struct nfs4_closedata *calldata = (struct nfs4_closedata *)task->tk_calldata; 881 struct nfs4_closedata *calldata = data;
884 struct nfs4_state *state = calldata->state; 882 struct nfs4_state *state = calldata->state;
885 struct nfs_server *server = NFS_SERVER(calldata->inode); 883 struct nfs_server *server = NFS_SERVER(calldata->inode);
886 884
@@ -904,7 +902,6 @@ static void nfs4_close_done(struct rpc_task *task)
904 } 902 }
905 } 903 }
906 nfs_refresh_inode(calldata->inode, calldata->res.fattr); 904 nfs_refresh_inode(calldata->inode, calldata->res.fattr);
907 nfs4_free_closedata(calldata);
908} 905}
909 906
910static void nfs4_close_begin(struct rpc_task *task) 907static void nfs4_close_begin(struct rpc_task *task)
@@ -918,10 +915,8 @@ static void nfs4_close_begin(struct rpc_task *task)
918 .rpc_cred = state->owner->so_cred, 915 .rpc_cred = state->owner->so_cred,
919 }; 916 };
920 int mode = 0, old_mode; 917 int mode = 0, old_mode;
921 int status;
922 918
923 status = nfs_wait_on_sequence(calldata->arg.seqid, task); 919 if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0)
924 if (status != 0)
925 return; 920 return;
926 /* Recalculate the new open mode in case someone reopened the file 921 /* Recalculate the new open mode in case someone reopened the file
927 * while we were waiting in line to be scheduled. 922 * while we were waiting in line to be scheduled.
@@ -937,9 +932,8 @@ static void nfs4_close_begin(struct rpc_task *task)
937 spin_unlock(&calldata->inode->i_lock); 932 spin_unlock(&calldata->inode->i_lock);
938 spin_unlock(&state->owner->so_lock); 933 spin_unlock(&state->owner->so_lock);
939 if (mode == old_mode || test_bit(NFS_DELEGATED_STATE, &state->flags)) { 934 if (mode == old_mode || test_bit(NFS_DELEGATED_STATE, &state->flags)) {
940 nfs4_free_closedata(calldata); 935 /* Note: exit _without_ calling nfs4_close_done */
941 task->tk_exit = NULL; 936 task->tk_action = NULL;
942 rpc_exit(task, 0);
943 return; 937 return;
944 } 938 }
945 nfs_fattr_init(calldata->res.fattr); 939 nfs_fattr_init(calldata->res.fattr);
@@ -949,6 +943,11 @@ static void nfs4_close_begin(struct rpc_task *task)
949 rpc_call_setup(task, &msg, 0); 943 rpc_call_setup(task, &msg, 0);
950} 944}
951 945
946static const struct rpc_call_ops nfs4_close_ops = {
947 .rpc_call_done = nfs4_close_done,
948 .rpc_release = nfs4_free_closedata,
949};
950
952/* 951/*
953 * It is possible for data to be read/written from a mem-mapped file 952 * It is possible for data to be read/written from a mem-mapped file
954 * after the sys_close call (which hits the vfs layer as a flush). 953 * after the sys_close call (which hits the vfs layer as a flush).
@@ -982,7 +981,7 @@ int nfs4_do_close(struct inode *inode, struct nfs4_state *state)
982 calldata->res.server = server; 981 calldata->res.server = server;
983 982
984 status = nfs4_call_async(server->client, nfs4_close_begin, 983 status = nfs4_call_async(server->client, nfs4_close_begin,
985 nfs4_close_done, calldata); 984 &nfs4_close_ops, calldata);
986 if (status == 0) 985 if (status == 0)
987 goto out; 986 goto out;
988 987
@@ -2125,10 +2124,9 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
2125 return err; 2124 return err;
2126} 2125}
2127 2126
2128static void 2127static void nfs4_read_done(struct rpc_task *task, void *calldata)
2129nfs4_read_done(struct rpc_task *task)
2130{ 2128{
2131 struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; 2129 struct nfs_read_data *data = calldata;
2132 struct inode *inode = data->inode; 2130 struct inode *inode = data->inode;
2133 2131
2134 if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { 2132 if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) {
@@ -2138,9 +2136,14 @@ nfs4_read_done(struct rpc_task *task)
2138 if (task->tk_status > 0) 2136 if (task->tk_status > 0)
2139 renew_lease(NFS_SERVER(inode), data->timestamp); 2137 renew_lease(NFS_SERVER(inode), data->timestamp);
2140 /* Call back common NFS readpage processing */ 2138 /* Call back common NFS readpage processing */
2141 nfs_readpage_result(task); 2139 nfs_readpage_result(task, calldata);
2142} 2140}
2143 2141
2142static const struct rpc_call_ops nfs4_read_ops = {
2143 .rpc_call_done = nfs4_read_done,
2144 .rpc_release = nfs_readdata_release,
2145};
2146
2144static void 2147static void
2145nfs4_proc_read_setup(struct nfs_read_data *data) 2148nfs4_proc_read_setup(struct nfs_read_data *data)
2146{ 2149{
@@ -2160,14 +2163,13 @@ nfs4_proc_read_setup(struct nfs_read_data *data)
2160 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); 2163 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
2161 2164
2162 /* Finalize the task. */ 2165 /* Finalize the task. */
2163 rpc_init_task(task, NFS_CLIENT(inode), nfs4_read_done, flags); 2166 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_read_ops, data);
2164 rpc_call_setup(task, &msg, 0); 2167 rpc_call_setup(task, &msg, 0);
2165} 2168}
2166 2169
2167static void 2170static void nfs4_write_done(struct rpc_task *task, void *calldata)
2168nfs4_write_done(struct rpc_task *task)
2169{ 2171{
2170 struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; 2172 struct nfs_write_data *data = calldata;
2171 struct inode *inode = data->inode; 2173 struct inode *inode = data->inode;
2172 2174
2173 if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { 2175 if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) {
@@ -2179,9 +2181,14 @@ nfs4_write_done(struct rpc_task *task)
2179 nfs_post_op_update_inode(inode, data->res.fattr); 2181 nfs_post_op_update_inode(inode, data->res.fattr);
2180 } 2182 }
2181 /* Call back common NFS writeback processing */ 2183 /* Call back common NFS writeback processing */
2182 nfs_writeback_done(task); 2184 nfs_writeback_done(task, calldata);
2183} 2185}
2184 2186
2187static const struct rpc_call_ops nfs4_write_ops = {
2188 .rpc_call_done = nfs4_write_done,
2189 .rpc_release = nfs_writedata_release,
2190};
2191
2185static void 2192static void
2186nfs4_proc_write_setup(struct nfs_write_data *data, int how) 2193nfs4_proc_write_setup(struct nfs_write_data *data, int how)
2187{ 2194{
@@ -2214,14 +2221,13 @@ nfs4_proc_write_setup(struct nfs_write_data *data, int how)
2214 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 2221 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
2215 2222
2216 /* Finalize the task. */ 2223 /* Finalize the task. */
2217 rpc_init_task(task, NFS_CLIENT(inode), nfs4_write_done, flags); 2224 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_write_ops, data);
2218 rpc_call_setup(task, &msg, 0); 2225 rpc_call_setup(task, &msg, 0);
2219} 2226}
2220 2227
2221static void 2228static void nfs4_commit_done(struct rpc_task *task, void *calldata)
2222nfs4_commit_done(struct rpc_task *task)
2223{ 2229{
2224 struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; 2230 struct nfs_write_data *data = calldata;
2225 struct inode *inode = data->inode; 2231 struct inode *inode = data->inode;
2226 2232
2227 if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { 2233 if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) {
@@ -2231,9 +2237,14 @@ nfs4_commit_done(struct rpc_task *task)
2231 if (task->tk_status >= 0) 2237 if (task->tk_status >= 0)
2232 nfs_post_op_update_inode(inode, data->res.fattr); 2238 nfs_post_op_update_inode(inode, data->res.fattr);
2233 /* Call back common NFS writeback processing */ 2239 /* Call back common NFS writeback processing */
2234 nfs_commit_done(task); 2240 nfs_commit_done(task, calldata);
2235} 2241}
2236 2242
2243static const struct rpc_call_ops nfs4_commit_ops = {
2244 .rpc_call_done = nfs4_commit_done,
2245 .rpc_release = nfs_commit_release,
2246};
2247
2237static void 2248static void
2238nfs4_proc_commit_setup(struct nfs_write_data *data, int how) 2249nfs4_proc_commit_setup(struct nfs_write_data *data, int how)
2239{ 2250{
@@ -2255,7 +2266,7 @@ nfs4_proc_commit_setup(struct nfs_write_data *data, int how)
2255 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 2266 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
2256 2267
2257 /* Finalize the task. */ 2268 /* Finalize the task. */
2258 rpc_init_task(task, NFS_CLIENT(inode), nfs4_commit_done, flags); 2269 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_commit_ops, data);
2259 rpc_call_setup(task, &msg, 0); 2270 rpc_call_setup(task, &msg, 0);
2260} 2271}
2261 2272
@@ -2263,11 +2274,10 @@ nfs4_proc_commit_setup(struct nfs_write_data *data, int how)
2263 * nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special 2274 * nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special
2264 * standalone procedure for queueing an asynchronous RENEW. 2275 * standalone procedure for queueing an asynchronous RENEW.
2265 */ 2276 */
2266static void 2277static void nfs4_renew_done(struct rpc_task *task, void *data)
2267renew_done(struct rpc_task *task)
2268{ 2278{
2269 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; 2279 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp;
2270 unsigned long timestamp = (unsigned long)task->tk_calldata; 2280 unsigned long timestamp = (unsigned long)data;
2271 2281
2272 if (task->tk_status < 0) { 2282 if (task->tk_status < 0) {
2273 switch (task->tk_status) { 2283 switch (task->tk_status) {
@@ -2284,6 +2294,10 @@ renew_done(struct rpc_task *task)
2284 spin_unlock(&clp->cl_lock); 2294 spin_unlock(&clp->cl_lock);
2285} 2295}
2286 2296
2297static const struct rpc_call_ops nfs4_renew_ops = {
2298 .rpc_call_done = nfs4_renew_done,
2299};
2300
2287int 2301int
2288nfs4_proc_async_renew(struct nfs4_client *clp) 2302nfs4_proc_async_renew(struct nfs4_client *clp)
2289{ 2303{
@@ -2294,7 +2308,7 @@ nfs4_proc_async_renew(struct nfs4_client *clp)
2294 }; 2308 };
2295 2309
2296 return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT, 2310 return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT,
2297 renew_done, (void *)jiffies); 2311 &nfs4_renew_ops, (void *)jiffies);
2298} 2312}
2299 2313
2300int 2314int
@@ -2866,15 +2880,16 @@ static void nfs4_locku_release_calldata(struct nfs4_unlockdata *calldata)
2866 } 2880 }
2867} 2881}
2868 2882
2869static void nfs4_locku_complete(struct nfs4_unlockdata *calldata) 2883static void nfs4_locku_complete(void *data)
2870{ 2884{
2885 struct nfs4_unlockdata *calldata = data;
2871 complete(&calldata->completion); 2886 complete(&calldata->completion);
2872 nfs4_locku_release_calldata(calldata); 2887 nfs4_locku_release_calldata(calldata);
2873} 2888}
2874 2889
2875static void nfs4_locku_done(struct rpc_task *task) 2890static void nfs4_locku_done(struct rpc_task *task, void *data)
2876{ 2891{
2877 struct nfs4_unlockdata *calldata = (struct nfs4_unlockdata *)task->tk_calldata; 2892 struct nfs4_unlockdata *calldata = data;
2878 2893
2879 nfs_increment_lock_seqid(task->tk_status, calldata->luargs.seqid); 2894 nfs_increment_lock_seqid(task->tk_status, calldata->luargs.seqid);
2880 switch (task->tk_status) { 2895 switch (task->tk_status) {
@@ -2890,10 +2905,8 @@ static void nfs4_locku_done(struct rpc_task *task)
2890 default: 2905 default:
2891 if (nfs4_async_handle_error(task, calldata->res.server) == -EAGAIN) { 2906 if (nfs4_async_handle_error(task, calldata->res.server) == -EAGAIN) {
2892 rpc_restart_call(task); 2907 rpc_restart_call(task);
2893 return;
2894 } 2908 }
2895 } 2909 }
2896 nfs4_locku_complete(calldata);
2897} 2910}
2898 2911
2899static void nfs4_locku_begin(struct rpc_task *task) 2912static void nfs4_locku_begin(struct rpc_task *task)
@@ -2911,14 +2924,18 @@ static void nfs4_locku_begin(struct rpc_task *task)
2911 if (status != 0) 2924 if (status != 0)
2912 return; 2925 return;
2913 if ((calldata->lsp->ls_flags & NFS_LOCK_INITIALIZED) == 0) { 2926 if ((calldata->lsp->ls_flags & NFS_LOCK_INITIALIZED) == 0) {
2914 nfs4_locku_complete(calldata); 2927 /* Note: exit _without_ running nfs4_locku_done */
2915 task->tk_exit = NULL; 2928 task->tk_action = NULL;
2916 rpc_exit(task, 0);
2917 return; 2929 return;
2918 } 2930 }
2919 rpc_call_setup(task, &msg, 0); 2931 rpc_call_setup(task, &msg, 0);
2920} 2932}
2921 2933
2934static const struct rpc_call_ops nfs4_locku_ops = {
2935 .rpc_call_done = nfs4_locku_done,
2936 .rpc_release = nfs4_locku_complete,
2937};
2938
2922static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) 2939static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request)
2923{ 2940{
2924 struct nfs4_unlockdata *calldata; 2941 struct nfs4_unlockdata *calldata;
@@ -2963,7 +2980,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
2963 init_completion(&calldata->completion); 2980 init_completion(&calldata->completion);
2964 2981
2965 status = nfs4_call_async(NFS_SERVER(inode)->client, nfs4_locku_begin, 2982 status = nfs4_call_async(NFS_SERVER(inode)->client, nfs4_locku_begin,
2966 nfs4_locku_done, calldata); 2983 &nfs4_locku_ops, calldata);
2967 if (status == 0) 2984 if (status == 0)
2968 wait_for_completion_interruptible(&calldata->completion); 2985 wait_for_completion_interruptible(&calldata->completion);
2969 do_vfs_lock(request->fl_file, request); 2986 do_vfs_lock(request->fl_file, request);
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index e1e3ca5d746b..6145e82b45e8 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -547,10 +547,9 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
547 547
548extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); 548extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
549 549
550static void 550static void nfs_read_done(struct rpc_task *task, void *calldata)
551nfs_read_done(struct rpc_task *task)
552{ 551{
553 struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; 552 struct nfs_read_data *data = calldata;
554 553
555 if (task->tk_status >= 0) { 554 if (task->tk_status >= 0) {
556 nfs_refresh_inode(data->inode, data->res.fattr); 555 nfs_refresh_inode(data->inode, data->res.fattr);
@@ -560,9 +559,14 @@ nfs_read_done(struct rpc_task *task)
560 if (data->args.offset + data->args.count >= data->res.fattr->size) 559 if (data->args.offset + data->args.count >= data->res.fattr->size)
561 data->res.eof = 1; 560 data->res.eof = 1;
562 } 561 }
563 nfs_readpage_result(task); 562 nfs_readpage_result(task, calldata);
564} 563}
565 564
565static const struct rpc_call_ops nfs_read_ops = {
566 .rpc_call_done = nfs_read_done,
567 .rpc_release = nfs_readdata_release,
568};
569
566static void 570static void
567nfs_proc_read_setup(struct nfs_read_data *data) 571nfs_proc_read_setup(struct nfs_read_data *data)
568{ 572{
@@ -580,20 +584,24 @@ nfs_proc_read_setup(struct nfs_read_data *data)
580 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); 584 flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
581 585
582 /* Finalize the task. */ 586 /* Finalize the task. */
583 rpc_init_task(task, NFS_CLIENT(inode), nfs_read_done, flags); 587 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_read_ops, data);
584 rpc_call_setup(task, &msg, 0); 588 rpc_call_setup(task, &msg, 0);
585} 589}
586 590
587static void 591static void nfs_write_done(struct rpc_task *task, void *calldata)
588nfs_write_done(struct rpc_task *task)
589{ 592{
590 struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; 593 struct nfs_write_data *data = calldata;
591 594
592 if (task->tk_status >= 0) 595 if (task->tk_status >= 0)
593 nfs_post_op_update_inode(data->inode, data->res.fattr); 596 nfs_post_op_update_inode(data->inode, data->res.fattr);
594 nfs_writeback_done(task); 597 nfs_writeback_done(task, calldata);
595} 598}
596 599
600static const struct rpc_call_ops nfs_write_ops = {
601 .rpc_call_done = nfs_write_done,
602 .rpc_release = nfs_writedata_release,
603};
604
597static void 605static void
598nfs_proc_write_setup(struct nfs_write_data *data, int how) 606nfs_proc_write_setup(struct nfs_write_data *data, int how)
599{ 607{
@@ -614,7 +622,7 @@ nfs_proc_write_setup(struct nfs_write_data *data, int how)
614 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; 622 flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
615 623
616 /* Finalize the task. */ 624 /* Finalize the task. */
617 rpc_init_task(task, NFS_CLIENT(inode), nfs_write_done, flags); 625 rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_write_ops, data);
618 rpc_call_setup(task, &msg, 0); 626 rpc_call_setup(task, &msg, 0);
619} 627}
620 628
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 5f20eafba8ec..21486242c3d3 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -42,9 +42,8 @@ mempool_t *nfs_rdata_mempool;
42 42
43#define MIN_POOL_READ (32) 43#define MIN_POOL_READ (32)
44 44
45void nfs_readdata_release(struct rpc_task *task) 45void nfs_readdata_release(void *data)
46{ 46{
47 struct nfs_read_data *data = (struct nfs_read_data *)task->tk_calldata;
48 nfs_readdata_free(data); 47 nfs_readdata_free(data);
49} 48}
50 49
@@ -220,9 +219,6 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
220 NFS_PROTO(inode)->read_setup(data); 219 NFS_PROTO(inode)->read_setup(data);
221 220
222 data->task.tk_cookie = (unsigned long)inode; 221 data->task.tk_cookie = (unsigned long)inode;
223 data->task.tk_calldata = data;
224 /* Release requests */
225 data->task.tk_release = nfs_readdata_release;
226 222
227 dprintk("NFS: %4d initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n", 223 dprintk("NFS: %4d initiated read call (req %s/%Ld, %u bytes @ offset %Lu)\n",
228 data->task.tk_pid, 224 data->task.tk_pid,
@@ -452,9 +448,9 @@ static void nfs_readpage_result_full(struct nfs_read_data *data, int status)
452 * This is the callback from RPC telling us whether a reply was 448 * This is the callback from RPC telling us whether a reply was
453 * received or some error occurred (timeout or socket shutdown). 449 * received or some error occurred (timeout or socket shutdown).
454 */ 450 */
455void nfs_readpage_result(struct rpc_task *task) 451void nfs_readpage_result(struct rpc_task *task, void *calldata)
456{ 452{
457 struct nfs_read_data *data = (struct nfs_read_data *)task->tk_calldata; 453 struct nfs_read_data *data = calldata;
458 struct nfs_readargs *argp = &data->args; 454 struct nfs_readargs *argp = &data->args;
459 struct nfs_readres *resp = &data->res; 455 struct nfs_readres *resp = &data->res;
460 int status = task->tk_status; 456 int status = task->tk_status;
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index d639d172d568..1494484ba86d 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -116,10 +116,9 @@ nfs_async_unlink_init(struct rpc_task *task)
116 * 116 *
117 * Do the directory attribute update. 117 * Do the directory attribute update.
118 */ 118 */
119static void 119static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
120nfs_async_unlink_done(struct rpc_task *task)
121{ 120{
122 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 121 struct nfs_unlinkdata *data = calldata;
123 struct dentry *dir = data->dir; 122 struct dentry *dir = data->dir;
124 struct inode *dir_i; 123 struct inode *dir_i;
125 124
@@ -141,13 +140,17 @@ nfs_async_unlink_done(struct rpc_task *task)
141 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the 140 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the
142 * rpc_task would be freed too. 141 * rpc_task would be freed too.
143 */ 142 */
144static void 143static void nfs_async_unlink_release(void *calldata)
145nfs_async_unlink_release(struct rpc_task *task)
146{ 144{
147 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 145 struct nfs_unlinkdata *data = calldata;
148 nfs_put_unlinkdata(data); 146 nfs_put_unlinkdata(data);
149} 147}
150 148
149static const struct rpc_call_ops nfs_unlink_ops = {
150 .rpc_call_done = nfs_async_unlink_done,
151 .rpc_release = nfs_async_unlink_release,
152};
153
151/** 154/**
152 * nfs_async_unlink - asynchronous unlinking of a file 155 * nfs_async_unlink - asynchronous unlinking of a file
153 * @dentry: dentry to unlink 156 * @dentry: dentry to unlink
@@ -179,10 +182,8 @@ nfs_async_unlink(struct dentry *dentry)
179 data->count = 1; 182 data->count = 1;
180 183
181 task = &data->task; 184 task = &data->task;
182 rpc_init_task(task, clnt, nfs_async_unlink_done , RPC_TASK_ASYNC); 185 rpc_init_task(task, clnt, RPC_TASK_ASYNC, &nfs_unlink_ops, data);
183 task->tk_calldata = data;
184 task->tk_action = nfs_async_unlink_init; 186 task->tk_action = nfs_async_unlink_init;
185 task->tk_release = nfs_async_unlink_release;
186 187
187 spin_lock(&dentry->d_lock); 188 spin_lock(&dentry->d_lock);
188 dentry->d_flags |= DCACHE_NFSFS_RENAMED; 189 dentry->d_flags |= DCACHE_NFSFS_RENAMED;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 95d00f9132d0..80bc4ea1b824 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -104,9 +104,8 @@ static inline void nfs_commit_free(struct nfs_write_data *p)
104 mempool_free(p, nfs_commit_mempool); 104 mempool_free(p, nfs_commit_mempool);
105} 105}
106 106
107static void nfs_writedata_release(struct rpc_task *task) 107void nfs_writedata_release(void *wdata)
108{ 108{
109 struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata;
110 nfs_writedata_free(wdata); 109 nfs_writedata_free(wdata);
111} 110}
112 111
@@ -871,9 +870,6 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
871 870
872 data->task.tk_priority = flush_task_priority(how); 871 data->task.tk_priority = flush_task_priority(how);
873 data->task.tk_cookie = (unsigned long)inode; 872 data->task.tk_cookie = (unsigned long)inode;
874 data->task.tk_calldata = data;
875 /* Release requests */
876 data->task.tk_release = nfs_writedata_release;
877 873
878 dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n", 874 dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n",
879 data->task.tk_pid, 875 data->task.tk_pid,
@@ -1131,9 +1127,9 @@ static void nfs_writeback_done_full(struct nfs_write_data *data, int status)
1131/* 1127/*
1132 * This function is called when the WRITE call is complete. 1128 * This function is called when the WRITE call is complete.
1133 */ 1129 */
1134void nfs_writeback_done(struct rpc_task *task) 1130void nfs_writeback_done(struct rpc_task *task, void *calldata)
1135{ 1131{
1136 struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; 1132 struct nfs_write_data *data = calldata;
1137 struct nfs_writeargs *argp = &data->args; 1133 struct nfs_writeargs *argp = &data->args;
1138 struct nfs_writeres *resp = &data->res; 1134 struct nfs_writeres *resp = &data->res;
1139 1135
@@ -1200,9 +1196,8 @@ void nfs_writeback_done(struct rpc_task *task)
1200 1196
1201 1197
1202#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1198#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
1203static void nfs_commit_release(struct rpc_task *task) 1199void nfs_commit_release(void *wdata)
1204{ 1200{
1205 struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata;
1206 nfs_commit_free(wdata); 1201 nfs_commit_free(wdata);
1207} 1202}
1208 1203
@@ -1238,9 +1233,6 @@ static void nfs_commit_rpcsetup(struct list_head *head,
1238 1233
1239 data->task.tk_priority = flush_task_priority(how); 1234 data->task.tk_priority = flush_task_priority(how);
1240 data->task.tk_cookie = (unsigned long)inode; 1235 data->task.tk_cookie = (unsigned long)inode;
1241 data->task.tk_calldata = data;
1242 /* Release requests */
1243 data->task.tk_release = nfs_commit_release;
1244 1236
1245 dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid); 1237 dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid);
1246} 1238}
@@ -1277,10 +1269,9 @@ nfs_commit_list(struct list_head *head, int how)
1277/* 1269/*
1278 * COMMIT call returned 1270 * COMMIT call returned
1279 */ 1271 */
1280void 1272void nfs_commit_done(struct rpc_task *task, void *calldata)
1281nfs_commit_done(struct rpc_task *task)
1282{ 1273{
1283 struct nfs_write_data *data = (struct nfs_write_data *)task->tk_calldata; 1274 struct nfs_write_data *data = calldata;
1284 struct nfs_page *req; 1275 struct nfs_page *req;
1285 int res = 0; 1276 int res = 0;
1286 1277