diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-14 15:40:01 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:05:32 -0500 |
commit | 5138fde01161cd7976fdc51f6a17da73adaa6baf (patch) | |
tree | 57dea902155fc4c31667ffbc412782edf2593b01 | |
parent | bdc7f021f3a1fade77adf3c2d7f65690566fddfe (diff) |
NFS/SUNRPC: Convert all users of rpc_call_setup()
Replace use of rpc_call_setup() with rpc_init_task(), and in cases where we
need to initialise task->tk_action, with rpc_call_start().
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 118 | ||||
-rw-r--r-- | fs/nfs/unlink.c | 28 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 40 |
3 files changed, 79 insertions, 107 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 7c0baf23abdc..826b445b8c70 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -718,19 +718,6 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
718 | return err; | 718 | return err; |
719 | } | 719 | } |
720 | 720 | ||
721 | static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata) | ||
722 | { | ||
723 | struct nfs4_opendata *data = calldata; | ||
724 | struct rpc_message msg = { | ||
725 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_CONFIRM], | ||
726 | .rpc_argp = &data->c_arg, | ||
727 | .rpc_resp = &data->c_res, | ||
728 | .rpc_cred = data->owner->so_cred, | ||
729 | }; | ||
730 | data->timestamp = jiffies; | ||
731 | rpc_call_setup(task, &msg, 0); | ||
732 | } | ||
733 | |||
734 | static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) | 721 | static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) |
735 | { | 722 | { |
736 | struct nfs4_opendata *data = calldata; | 723 | struct nfs4_opendata *data = calldata; |
@@ -767,7 +754,6 @@ out_free: | |||
767 | } | 754 | } |
768 | 755 | ||
769 | static const struct rpc_call_ops nfs4_open_confirm_ops = { | 756 | static const struct rpc_call_ops nfs4_open_confirm_ops = { |
770 | .rpc_call_prepare = nfs4_open_confirm_prepare, | ||
771 | .rpc_call_done = nfs4_open_confirm_done, | 757 | .rpc_call_done = nfs4_open_confirm_done, |
772 | .rpc_release = nfs4_open_confirm_release, | 758 | .rpc_release = nfs4_open_confirm_release, |
773 | }; | 759 | }; |
@@ -779,8 +765,15 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) | |||
779 | { | 765 | { |
780 | struct nfs_server *server = NFS_SERVER(data->dir->d_inode); | 766 | struct nfs_server *server = NFS_SERVER(data->dir->d_inode); |
781 | struct rpc_task *task; | 767 | struct rpc_task *task; |
768 | struct rpc_message msg = { | ||
769 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_CONFIRM], | ||
770 | .rpc_argp = &data->c_arg, | ||
771 | .rpc_resp = &data->c_res, | ||
772 | .rpc_cred = data->owner->so_cred, | ||
773 | }; | ||
782 | struct rpc_task_setup task_setup_data = { | 774 | struct rpc_task_setup task_setup_data = { |
783 | .rpc_client = server->client, | 775 | .rpc_client = server->client, |
776 | .rpc_message = &msg, | ||
784 | .callback_ops = &nfs4_open_confirm_ops, | 777 | .callback_ops = &nfs4_open_confirm_ops, |
785 | .callback_data = data, | 778 | .callback_data = data, |
786 | .flags = RPC_TASK_ASYNC, | 779 | .flags = RPC_TASK_ASYNC, |
@@ -790,6 +783,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) | |||
790 | kref_get(&data->kref); | 783 | kref_get(&data->kref); |
791 | data->rpc_done = 0; | 784 | data->rpc_done = 0; |
792 | data->rpc_status = 0; | 785 | data->rpc_status = 0; |
786 | data->timestamp = jiffies; | ||
793 | task = rpc_run_task(&task_setup_data); | 787 | task = rpc_run_task(&task_setup_data); |
794 | if (IS_ERR(task)) | 788 | if (IS_ERR(task)) |
795 | return PTR_ERR(task); | 789 | return PTR_ERR(task); |
@@ -807,13 +801,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
807 | { | 801 | { |
808 | struct nfs4_opendata *data = calldata; | 802 | struct nfs4_opendata *data = calldata; |
809 | struct nfs4_state_owner *sp = data->owner; | 803 | struct nfs4_state_owner *sp = data->owner; |
810 | struct rpc_message msg = { | 804 | |
811 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN], | ||
812 | .rpc_argp = &data->o_arg, | ||
813 | .rpc_resp = &data->o_res, | ||
814 | .rpc_cred = sp->so_cred, | ||
815 | }; | ||
816 | |||
817 | if (nfs_wait_on_sequence(data->o_arg.seqid, task) != 0) | 805 | if (nfs_wait_on_sequence(data->o_arg.seqid, task) != 0) |
818 | return; | 806 | return; |
819 | /* | 807 | /* |
@@ -838,11 +826,11 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
838 | data->o_arg.id = sp->so_owner_id.id; | 826 | data->o_arg.id = sp->so_owner_id.id; |
839 | data->o_arg.clientid = sp->so_client->cl_clientid; | 827 | data->o_arg.clientid = sp->so_client->cl_clientid; |
840 | if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) { | 828 | if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) { |
841 | msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; | 829 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; |
842 | nfs_copy_fh(&data->o_res.fh, data->o_arg.fh); | 830 | nfs_copy_fh(&data->o_res.fh, data->o_arg.fh); |
843 | } | 831 | } |
844 | data->timestamp = jiffies; | 832 | data->timestamp = jiffies; |
845 | rpc_call_setup(task, &msg, 0); | 833 | rpc_call_start(task); |
846 | return; | 834 | return; |
847 | out_no_action: | 835 | out_no_action: |
848 | task->tk_action = NULL; | 836 | task->tk_action = NULL; |
@@ -914,8 +902,15 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
914 | struct nfs_openargs *o_arg = &data->o_arg; | 902 | struct nfs_openargs *o_arg = &data->o_arg; |
915 | struct nfs_openres *o_res = &data->o_res; | 903 | struct nfs_openres *o_res = &data->o_res; |
916 | struct rpc_task *task; | 904 | struct rpc_task *task; |
905 | struct rpc_message msg = { | ||
906 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN], | ||
907 | .rpc_argp = o_arg, | ||
908 | .rpc_resp = o_res, | ||
909 | .rpc_cred = data->owner->so_cred, | ||
910 | }; | ||
917 | struct rpc_task_setup task_setup_data = { | 911 | struct rpc_task_setup task_setup_data = { |
918 | .rpc_client = server->client, | 912 | .rpc_client = server->client, |
913 | .rpc_message = &msg, | ||
919 | .callback_ops = &nfs4_open_ops, | 914 | .callback_ops = &nfs4_open_ops, |
920 | .callback_data = data, | 915 | .callback_data = data, |
921 | .flags = RPC_TASK_ASYNC, | 916 | .flags = RPC_TASK_ASYNC, |
@@ -1256,12 +1251,6 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
1256 | { | 1251 | { |
1257 | struct nfs4_closedata *calldata = data; | 1252 | struct nfs4_closedata *calldata = data; |
1258 | struct nfs4_state *state = calldata->state; | 1253 | struct nfs4_state *state = calldata->state; |
1259 | struct rpc_message msg = { | ||
1260 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE], | ||
1261 | .rpc_argp = &calldata->arg, | ||
1262 | .rpc_resp = &calldata->res, | ||
1263 | .rpc_cred = state->owner->so_cred, | ||
1264 | }; | ||
1265 | int clear_rd, clear_wr, clear_rdwr; | 1254 | int clear_rd, clear_wr, clear_rdwr; |
1266 | 1255 | ||
1267 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) | 1256 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) |
@@ -1288,14 +1277,14 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
1288 | } | 1277 | } |
1289 | nfs_fattr_init(calldata->res.fattr); | 1278 | nfs_fattr_init(calldata->res.fattr); |
1290 | if (test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0) { | 1279 | if (test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0) { |
1291 | msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; | 1280 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; |
1292 | calldata->arg.open_flags = FMODE_READ; | 1281 | calldata->arg.open_flags = FMODE_READ; |
1293 | } else if (test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0) { | 1282 | } else if (test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0) { |
1294 | msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; | 1283 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; |
1295 | calldata->arg.open_flags = FMODE_WRITE; | 1284 | calldata->arg.open_flags = FMODE_WRITE; |
1296 | } | 1285 | } |
1297 | calldata->timestamp = jiffies; | 1286 | calldata->timestamp = jiffies; |
1298 | rpc_call_setup(task, &msg, 0); | 1287 | rpc_call_start(task); |
1299 | } | 1288 | } |
1300 | 1289 | ||
1301 | static const struct rpc_call_ops nfs4_close_ops = { | 1290 | static const struct rpc_call_ops nfs4_close_ops = { |
@@ -1321,8 +1310,13 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait) | |||
1321 | struct nfs4_closedata *calldata; | 1310 | struct nfs4_closedata *calldata; |
1322 | struct nfs4_state_owner *sp = state->owner; | 1311 | struct nfs4_state_owner *sp = state->owner; |
1323 | struct rpc_task *task; | 1312 | struct rpc_task *task; |
1313 | struct rpc_message msg = { | ||
1314 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE], | ||
1315 | .rpc_cred = state->owner->so_cred, | ||
1316 | }; | ||
1324 | struct rpc_task_setup task_setup_data = { | 1317 | struct rpc_task_setup task_setup_data = { |
1325 | .rpc_client = server->client, | 1318 | .rpc_client = server->client, |
1319 | .rpc_message = &msg, | ||
1326 | .callback_ops = &nfs4_close_ops, | 1320 | .callback_ops = &nfs4_close_ops, |
1327 | .flags = RPC_TASK_ASYNC, | 1321 | .flags = RPC_TASK_ASYNC, |
1328 | }; | 1322 | }; |
@@ -1345,6 +1339,8 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait) | |||
1345 | calldata->path.mnt = mntget(path->mnt); | 1339 | calldata->path.mnt = mntget(path->mnt); |
1346 | calldata->path.dentry = dget(path->dentry); | 1340 | calldata->path.dentry = dget(path->dentry); |
1347 | 1341 | ||
1342 | msg.rpc_argp = &calldata->arg, | ||
1343 | msg.rpc_resp = &calldata->res, | ||
1348 | task_setup_data.callback_data = calldata; | 1344 | task_setup_data.callback_data = calldata; |
1349 | task = rpc_run_task(&task_setup_data); | 1345 | task = rpc_run_task(&task_setup_data); |
1350 | if (IS_ERR(task)) | 1346 | if (IS_ERR(task)) |
@@ -2966,25 +2962,11 @@ struct nfs4_delegreturndata { | |||
2966 | struct nfs4_delegreturnres res; | 2962 | struct nfs4_delegreturnres res; |
2967 | struct nfs_fh fh; | 2963 | struct nfs_fh fh; |
2968 | nfs4_stateid stateid; | 2964 | nfs4_stateid stateid; |
2969 | struct rpc_cred *cred; | ||
2970 | unsigned long timestamp; | 2965 | unsigned long timestamp; |
2971 | struct nfs_fattr fattr; | 2966 | struct nfs_fattr fattr; |
2972 | int rpc_status; | 2967 | int rpc_status; |
2973 | }; | 2968 | }; |
2974 | 2969 | ||
2975 | static void nfs4_delegreturn_prepare(struct rpc_task *task, void *calldata) | ||
2976 | { | ||
2977 | struct nfs4_delegreturndata *data = calldata; | ||
2978 | struct rpc_message msg = { | ||
2979 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DELEGRETURN], | ||
2980 | .rpc_argp = &data->args, | ||
2981 | .rpc_resp = &data->res, | ||
2982 | .rpc_cred = data->cred, | ||
2983 | }; | ||
2984 | nfs_fattr_init(data->res.fattr); | ||
2985 | rpc_call_setup(task, &msg, 0); | ||
2986 | } | ||
2987 | |||
2988 | static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) | 2970 | static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) |
2989 | { | 2971 | { |
2990 | struct nfs4_delegreturndata *data = calldata; | 2972 | struct nfs4_delegreturndata *data = calldata; |
@@ -2995,14 +2977,10 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) | |||
2995 | 2977 | ||
2996 | static void nfs4_delegreturn_release(void *calldata) | 2978 | static void nfs4_delegreturn_release(void *calldata) |
2997 | { | 2979 | { |
2998 | struct nfs4_delegreturndata *data = calldata; | ||
2999 | |||
3000 | put_rpccred(data->cred); | ||
3001 | kfree(calldata); | 2980 | kfree(calldata); |
3002 | } | 2981 | } |
3003 | 2982 | ||
3004 | static const struct rpc_call_ops nfs4_delegreturn_ops = { | 2983 | static const struct rpc_call_ops nfs4_delegreturn_ops = { |
3005 | .rpc_call_prepare = nfs4_delegreturn_prepare, | ||
3006 | .rpc_call_done = nfs4_delegreturn_done, | 2984 | .rpc_call_done = nfs4_delegreturn_done, |
3007 | .rpc_release = nfs4_delegreturn_release, | 2985 | .rpc_release = nfs4_delegreturn_release, |
3008 | }; | 2986 | }; |
@@ -3012,8 +2990,13 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co | |||
3012 | struct nfs4_delegreturndata *data; | 2990 | struct nfs4_delegreturndata *data; |
3013 | struct nfs_server *server = NFS_SERVER(inode); | 2991 | struct nfs_server *server = NFS_SERVER(inode); |
3014 | struct rpc_task *task; | 2992 | struct rpc_task *task; |
2993 | struct rpc_message msg = { | ||
2994 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DELEGRETURN], | ||
2995 | .rpc_cred = cred, | ||
2996 | }; | ||
3015 | struct rpc_task_setup task_setup_data = { | 2997 | struct rpc_task_setup task_setup_data = { |
3016 | .rpc_client = server->client, | 2998 | .rpc_client = server->client, |
2999 | .rpc_message = &msg, | ||
3017 | .callback_ops = &nfs4_delegreturn_ops, | 3000 | .callback_ops = &nfs4_delegreturn_ops, |
3018 | .flags = RPC_TASK_ASYNC, | 3001 | .flags = RPC_TASK_ASYNC, |
3019 | }; | 3002 | }; |
@@ -3029,11 +3012,13 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co | |||
3029 | memcpy(&data->stateid, stateid, sizeof(data->stateid)); | 3012 | memcpy(&data->stateid, stateid, sizeof(data->stateid)); |
3030 | data->res.fattr = &data->fattr; | 3013 | data->res.fattr = &data->fattr; |
3031 | data->res.server = server; | 3014 | data->res.server = server; |
3032 | data->cred = get_rpccred(cred); | 3015 | nfs_fattr_init(data->res.fattr); |
3033 | data->timestamp = jiffies; | 3016 | data->timestamp = jiffies; |
3034 | data->rpc_status = 0; | 3017 | data->rpc_status = 0; |
3035 | 3018 | ||
3036 | task_setup_data.callback_data = data; | 3019 | task_setup_data.callback_data = data; |
3020 | msg.rpc_argp = &data->args, | ||
3021 | msg.rpc_resp = &data->res, | ||
3037 | task = rpc_run_task(&task_setup_data); | 3022 | task = rpc_run_task(&task_setup_data); |
3038 | if (IS_ERR(task)) | 3023 | if (IS_ERR(task)) |
3039 | return PTR_ERR(task); | 3024 | return PTR_ERR(task); |
@@ -3221,12 +3206,6 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) | |||
3221 | static void nfs4_locku_prepare(struct rpc_task *task, void *data) | 3206 | static void nfs4_locku_prepare(struct rpc_task *task, void *data) |
3222 | { | 3207 | { |
3223 | struct nfs4_unlockdata *calldata = data; | 3208 | struct nfs4_unlockdata *calldata = data; |
3224 | struct rpc_message msg = { | ||
3225 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOCKU], | ||
3226 | .rpc_argp = &calldata->arg, | ||
3227 | .rpc_resp = &calldata->res, | ||
3228 | .rpc_cred = calldata->lsp->ls_state->owner->so_cred, | ||
3229 | }; | ||
3230 | 3209 | ||
3231 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) | 3210 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) |
3232 | return; | 3211 | return; |
@@ -3236,7 +3215,7 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) | |||
3236 | return; | 3215 | return; |
3237 | } | 3216 | } |
3238 | calldata->timestamp = jiffies; | 3217 | calldata->timestamp = jiffies; |
3239 | rpc_call_setup(task, &msg, 0); | 3218 | rpc_call_start(task); |
3240 | } | 3219 | } |
3241 | 3220 | ||
3242 | static const struct rpc_call_ops nfs4_locku_ops = { | 3221 | static const struct rpc_call_ops nfs4_locku_ops = { |
@@ -3251,8 +3230,13 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, | |||
3251 | struct nfs_seqid *seqid) | 3230 | struct nfs_seqid *seqid) |
3252 | { | 3231 | { |
3253 | struct nfs4_unlockdata *data; | 3232 | struct nfs4_unlockdata *data; |
3233 | struct rpc_message msg = { | ||
3234 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOCKU], | ||
3235 | .rpc_cred = ctx->cred, | ||
3236 | }; | ||
3254 | struct rpc_task_setup task_setup_data = { | 3237 | struct rpc_task_setup task_setup_data = { |
3255 | .rpc_client = NFS_CLIENT(lsp->ls_state->inode), | 3238 | .rpc_client = NFS_CLIENT(lsp->ls_state->inode), |
3239 | .rpc_message = &msg, | ||
3256 | .callback_ops = &nfs4_locku_ops, | 3240 | .callback_ops = &nfs4_locku_ops, |
3257 | .flags = RPC_TASK_ASYNC, | 3241 | .flags = RPC_TASK_ASYNC, |
3258 | }; | 3242 | }; |
@@ -3268,6 +3252,8 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, | |||
3268 | return ERR_PTR(-ENOMEM); | 3252 | return ERR_PTR(-ENOMEM); |
3269 | } | 3253 | } |
3270 | 3254 | ||
3255 | msg.rpc_argp = &data->arg, | ||
3256 | msg.rpc_resp = &data->res, | ||
3271 | task_setup_data.callback_data = data; | 3257 | task_setup_data.callback_data = data; |
3272 | return rpc_run_task(&task_setup_data); | 3258 | return rpc_run_task(&task_setup_data); |
3273 | } | 3259 | } |
@@ -3353,13 +3339,6 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
3353 | { | 3339 | { |
3354 | struct nfs4_lockdata *data = calldata; | 3340 | struct nfs4_lockdata *data = calldata; |
3355 | struct nfs4_state *state = data->lsp->ls_state; | 3341 | struct nfs4_state *state = data->lsp->ls_state; |
3356 | struct nfs4_state_owner *sp = state->owner; | ||
3357 | struct rpc_message msg = { | ||
3358 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOCK], | ||
3359 | .rpc_argp = &data->arg, | ||
3360 | .rpc_resp = &data->res, | ||
3361 | .rpc_cred = sp->so_cred, | ||
3362 | }; | ||
3363 | 3342 | ||
3364 | dprintk("%s: begin!\n", __FUNCTION__); | 3343 | dprintk("%s: begin!\n", __FUNCTION__); |
3365 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) | 3344 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) |
@@ -3373,7 +3352,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
3373 | } else | 3352 | } else |
3374 | data->arg.new_lock_owner = 0; | 3353 | data->arg.new_lock_owner = 0; |
3375 | data->timestamp = jiffies; | 3354 | data->timestamp = jiffies; |
3376 | rpc_call_setup(task, &msg, 0); | 3355 | rpc_call_start(task); |
3377 | dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); | 3356 | dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); |
3378 | } | 3357 | } |
3379 | 3358 | ||
@@ -3435,8 +3414,13 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
3435 | { | 3414 | { |
3436 | struct nfs4_lockdata *data; | 3415 | struct nfs4_lockdata *data; |
3437 | struct rpc_task *task; | 3416 | struct rpc_task *task; |
3417 | struct rpc_message msg = { | ||
3418 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOCK], | ||
3419 | .rpc_cred = state->owner->so_cred, | ||
3420 | }; | ||
3438 | struct rpc_task_setup task_setup_data = { | 3421 | struct rpc_task_setup task_setup_data = { |
3439 | .rpc_client = NFS_CLIENT(state->inode), | 3422 | .rpc_client = NFS_CLIENT(state->inode), |
3423 | .rpc_message = &msg, | ||
3440 | .callback_ops = &nfs4_lock_ops, | 3424 | .callback_ops = &nfs4_lock_ops, |
3441 | .flags = RPC_TASK_ASYNC, | 3425 | .flags = RPC_TASK_ASYNC, |
3442 | }; | 3426 | }; |
@@ -3451,6 +3435,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
3451 | data->arg.block = 1; | 3435 | data->arg.block = 1; |
3452 | if (reclaim != 0) | 3436 | if (reclaim != 0) |
3453 | data->arg.reclaim = 1; | 3437 | data->arg.reclaim = 1; |
3438 | msg.rpc_argp = &data->arg, | ||
3439 | msg.rpc_resp = &data->res, | ||
3454 | task_setup_data.callback_data = data; | 3440 | task_setup_data.callback_data = data; |
3455 | task = rpc_run_task(&task_setup_data); | 3441 | task = rpc_run_task(&task_setup_data); |
3456 | if (IS_ERR(task)) | 3442 | if (IS_ERR(task)) |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 6660d9a53345..757415363422 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -71,24 +71,6 @@ static void nfs_dec_sillycount(struct inode *dir) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * nfs_async_unlink_init - Initialize the RPC info | ||
75 | * task: rpc_task of the sillydelete | ||
76 | */ | ||
77 | static void nfs_async_unlink_init(struct rpc_task *task, void *calldata) | ||
78 | { | ||
79 | struct nfs_unlinkdata *data = calldata; | ||
80 | struct inode *dir = data->dir; | ||
81 | struct rpc_message msg = { | ||
82 | .rpc_argp = &data->args, | ||
83 | .rpc_resp = &data->res, | ||
84 | .rpc_cred = data->cred, | ||
85 | }; | ||
86 | |||
87 | NFS_PROTO(dir)->unlink_setup(&msg, dir); | ||
88 | rpc_call_setup(task, &msg, 0); | ||
89 | } | ||
90 | |||
91 | /** | ||
92 | * nfs_async_unlink_done - Sillydelete post-processing | 74 | * nfs_async_unlink_done - Sillydelete post-processing |
93 | * @task: rpc_task of the sillydelete | 75 | * @task: rpc_task of the sillydelete |
94 | * | 76 | * |
@@ -120,14 +102,19 @@ static void nfs_async_unlink_release(void *calldata) | |||
120 | } | 102 | } |
121 | 103 | ||
122 | static const struct rpc_call_ops nfs_unlink_ops = { | 104 | static const struct rpc_call_ops nfs_unlink_ops = { |
123 | .rpc_call_prepare = nfs_async_unlink_init, | ||
124 | .rpc_call_done = nfs_async_unlink_done, | 105 | .rpc_call_done = nfs_async_unlink_done, |
125 | .rpc_release = nfs_async_unlink_release, | 106 | .rpc_release = nfs_async_unlink_release, |
126 | }; | 107 | }; |
127 | 108 | ||
128 | static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) | 109 | static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) |
129 | { | 110 | { |
111 | struct rpc_message msg = { | ||
112 | .rpc_argp = &data->args, | ||
113 | .rpc_resp = &data->res, | ||
114 | .rpc_cred = data->cred, | ||
115 | }; | ||
130 | struct rpc_task_setup task_setup_data = { | 116 | struct rpc_task_setup task_setup_data = { |
117 | .rpc_message = &msg, | ||
131 | .callback_ops = &nfs_unlink_ops, | 118 | .callback_ops = &nfs_unlink_ops, |
132 | .callback_data = data, | 119 | .callback_data = data, |
133 | .flags = RPC_TASK_ASYNC, | 120 | .flags = RPC_TASK_ASYNC, |
@@ -165,8 +152,9 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n | |||
165 | data->args.fh = NFS_FH(dir); | 152 | data->args.fh = NFS_FH(dir); |
166 | nfs_fattr_init(&data->res.dir_attr); | 153 | nfs_fattr_init(&data->res.dir_attr); |
167 | 154 | ||
168 | task_setup_data.rpc_client = NFS_CLIENT(dir); | 155 | NFS_PROTO(dir)->unlink_setup(&msg, dir); |
169 | 156 | ||
157 | task_setup_data.rpc_client = NFS_CLIENT(dir); | ||
170 | task = rpc_run_task(&task_setup_data); | 158 | task = rpc_run_task(&task_setup_data); |
171 | if (!IS_ERR(task)) | 159 | if (!IS_ERR(task)) |
172 | rpc_put_task(task); | 160 | rpc_put_task(task); |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 7c362e5f6e1b..f876e37d1972 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -128,19 +128,6 @@ struct rpcb_info { | |||
128 | static struct rpcb_info rpcb_next_version[]; | 128 | static struct rpcb_info rpcb_next_version[]; |
129 | static struct rpcb_info rpcb_next_version6[]; | 129 | static struct rpcb_info rpcb_next_version6[]; |
130 | 130 | ||
131 | static void rpcb_getport_prepare(struct rpc_task *task, void *calldata) | ||
132 | { | ||
133 | struct rpcbind_args *map = calldata; | ||
134 | struct rpc_xprt *xprt = map->r_xprt; | ||
135 | struct rpc_message msg = { | ||
136 | .rpc_proc = rpcb_next_version[xprt->bind_index].rpc_proc, | ||
137 | .rpc_argp = map, | ||
138 | .rpc_resp = &map->r_port, | ||
139 | }; | ||
140 | |||
141 | rpc_call_setup(task, &msg, 0); | ||
142 | } | ||
143 | |||
144 | static void rpcb_map_release(void *data) | 131 | static void rpcb_map_release(void *data) |
145 | { | 132 | { |
146 | struct rpcbind_args *map = data; | 133 | struct rpcbind_args *map = data; |
@@ -150,7 +137,6 @@ static void rpcb_map_release(void *data) | |||
150 | } | 137 | } |
151 | 138 | ||
152 | static const struct rpc_call_ops rpcb_getport_ops = { | 139 | static const struct rpc_call_ops rpcb_getport_ops = { |
153 | .rpc_call_prepare = rpcb_getport_prepare, | ||
154 | .rpc_call_done = rpcb_getport_done, | 140 | .rpc_call_done = rpcb_getport_done, |
155 | .rpc_release = rpcb_map_release, | 141 | .rpc_release = rpcb_map_release, |
156 | }; | 142 | }; |
@@ -295,6 +281,24 @@ int rpcb_getport_sync(struct sockaddr_in *sin, __u32 prog, | |||
295 | } | 281 | } |
296 | EXPORT_SYMBOL_GPL(rpcb_getport_sync); | 282 | EXPORT_SYMBOL_GPL(rpcb_getport_sync); |
297 | 283 | ||
284 | static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, int version) | ||
285 | { | ||
286 | struct rpc_message msg = { | ||
287 | .rpc_proc = rpcb_next_version[version].rpc_proc, | ||
288 | .rpc_argp = map, | ||
289 | .rpc_resp = &map->r_port, | ||
290 | }; | ||
291 | struct rpc_task_setup task_setup_data = { | ||
292 | .rpc_client = rpcb_clnt, | ||
293 | .rpc_message = &msg, | ||
294 | .callback_ops = &rpcb_getport_ops, | ||
295 | .callback_data = map, | ||
296 | .flags = RPC_TASK_ASYNC, | ||
297 | }; | ||
298 | |||
299 | return rpc_run_task(&task_setup_data); | ||
300 | } | ||
301 | |||
298 | /** | 302 | /** |
299 | * rpcb_getport_async - obtain the port for a given RPC service on a given host | 303 | * rpcb_getport_async - obtain the port for a given RPC service on a given host |
300 | * @task: task that is waiting for portmapper request | 304 | * @task: task that is waiting for portmapper request |
@@ -310,10 +314,6 @@ void rpcb_getport_async(struct rpc_task *task) | |||
310 | struct rpc_clnt *rpcb_clnt; | 314 | struct rpc_clnt *rpcb_clnt; |
311 | static struct rpcbind_args *map; | 315 | static struct rpcbind_args *map; |
312 | struct rpc_task *child; | 316 | struct rpc_task *child; |
313 | struct rpc_task_setup task_setup_data = { | ||
314 | .callback_ops = &rpcb_getport_ops, | ||
315 | .flags = RPC_TASK_ASYNC, | ||
316 | }; | ||
317 | struct sockaddr addr; | 317 | struct sockaddr addr; |
318 | int status; | 318 | int status; |
319 | struct rpcb_info *info; | 319 | struct rpcb_info *info; |
@@ -399,9 +399,7 @@ void rpcb_getport_async(struct rpc_task *task) | |||
399 | sizeof(map->r_addr)); | 399 | sizeof(map->r_addr)); |
400 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ | 400 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ |
401 | 401 | ||
402 | task_setup_data.rpc_client = rpcb_clnt; | 402 | child = rpcb_call_async(rpcb_clnt, map, xprt->bind_index); |
403 | task_setup_data.callback_data = map; | ||
404 | child = rpc_run_task(&task_setup_data); | ||
405 | rpc_release_client(rpcb_clnt); | 403 | rpc_release_client(rpcb_clnt); |
406 | if (IS_ERR(child)) { | 404 | if (IS_ERR(child)) { |
407 | status = -EIO; | 405 | status = -EIO; |