diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4_fs.h | 14 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 49 | ||||
-rw-r--r-- | fs/nfs/read.c | 2 | ||||
-rw-r--r-- | fs/nfs/unlink.c | 2 | ||||
-rw-r--r-- | fs/nfs/write.c | 4 |
5 files changed, 43 insertions, 28 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index c538c6106e16..9c0aa818b41e 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -223,7 +223,12 @@ extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | |||
223 | extern struct nfs4_state_recovery_ops *nfs4_reboot_recovery_ops[]; | 223 | extern struct nfs4_state_recovery_ops *nfs4_reboot_recovery_ops[]; |
224 | extern struct nfs4_state_recovery_ops *nfs4_nograce_recovery_ops[]; | 224 | extern struct nfs4_state_recovery_ops *nfs4_nograce_recovery_ops[]; |
225 | #if defined(CONFIG_NFS_V4_1) | 225 | #if defined(CONFIG_NFS_V4_1) |
226 | extern int nfs4_setup_sequence(struct nfs_client *clp, | 226 | static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *server) |
227 | { | ||
228 | return server->nfs_client->cl_session; | ||
229 | } | ||
230 | |||
231 | extern int nfs4_setup_sequence(const struct nfs_server *server, | ||
227 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, | 232 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, |
228 | int cache_reply, struct rpc_task *task); | 233 | int cache_reply, struct rpc_task *task); |
229 | extern void nfs4_destroy_session(struct nfs4_session *session); | 234 | extern void nfs4_destroy_session(struct nfs4_session *session); |
@@ -234,7 +239,12 @@ extern int nfs4_init_session(struct nfs_server *server); | |||
234 | extern int nfs4_proc_get_lease_time(struct nfs_client *clp, | 239 | extern int nfs4_proc_get_lease_time(struct nfs_client *clp, |
235 | struct nfs_fsinfo *fsinfo); | 240 | struct nfs_fsinfo *fsinfo); |
236 | #else /* CONFIG_NFS_v4_1 */ | 241 | #else /* CONFIG_NFS_v4_1 */ |
237 | static inline int nfs4_setup_sequence(struct nfs_client *clp, | 242 | static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *server) |
243 | { | ||
244 | return NULL; | ||
245 | } | ||
246 | |||
247 | static inline int nfs4_setup_sequence(const struct nfs_server *server, | ||
238 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, | 248 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, |
239 | int cache_reply, struct rpc_task *task) | 249 | int cache_reply, struct rpc_task *task) |
240 | { | 250 | { |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 75847e4898a0..0168007b78d2 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -531,20 +531,25 @@ static int nfs41_setup_sequence(struct nfs4_session *session, | |||
531 | return 0; | 531 | return 0; |
532 | } | 532 | } |
533 | 533 | ||
534 | int nfs4_setup_sequence(struct nfs_client *clp, | 534 | int nfs4_setup_sequence(const struct nfs_server *server, |
535 | struct nfs4_sequence_args *args, | 535 | struct nfs4_sequence_args *args, |
536 | struct nfs4_sequence_res *res, | 536 | struct nfs4_sequence_res *res, |
537 | int cache_reply, | 537 | int cache_reply, |
538 | struct rpc_task *task) | 538 | struct rpc_task *task) |
539 | { | 539 | { |
540 | struct nfs4_session *session = nfs4_get_session(server); | ||
540 | int ret = 0; | 541 | int ret = 0; |
541 | 542 | ||
543 | if (session == NULL) { | ||
544 | args->sa_session = NULL; | ||
545 | res->sr_session = NULL; | ||
546 | goto out; | ||
547 | } | ||
548 | |||
542 | dprintk("--> %s clp %p session %p sr_slotid %d\n", | 549 | dprintk("--> %s clp %p session %p sr_slotid %d\n", |
543 | __func__, clp, clp->cl_session, res->sr_slotid); | 550 | __func__, session->clp, session, res->sr_slotid); |
544 | 551 | ||
545 | if (!nfs4_has_session(clp)) | 552 | ret = nfs41_setup_sequence(session, args, res, cache_reply, |
546 | goto out; | ||
547 | ret = nfs41_setup_sequence(clp->cl_session, args, res, cache_reply, | ||
548 | task); | 553 | task); |
549 | out: | 554 | out: |
550 | dprintk("<-- %s status=%d\n", __func__, ret); | 555 | dprintk("<-- %s status=%d\n", __func__, ret); |
@@ -552,7 +557,7 @@ out: | |||
552 | } | 557 | } |
553 | 558 | ||
554 | struct nfs41_call_sync_data { | 559 | struct nfs41_call_sync_data { |
555 | struct nfs_client *clp; | 560 | const struct nfs_server *seq_server; |
556 | struct nfs4_sequence_args *seq_args; | 561 | struct nfs4_sequence_args *seq_args; |
557 | struct nfs4_sequence_res *seq_res; | 562 | struct nfs4_sequence_res *seq_res; |
558 | int cache_reply; | 563 | int cache_reply; |
@@ -562,9 +567,9 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) | |||
562 | { | 567 | { |
563 | struct nfs41_call_sync_data *data = calldata; | 568 | struct nfs41_call_sync_data *data = calldata; |
564 | 569 | ||
565 | dprintk("--> %s data->clp->cl_session %p\n", __func__, | 570 | dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server); |
566 | data->clp->cl_session); | 571 | |
567 | if (nfs4_setup_sequence(data->clp, data->seq_args, | 572 | if (nfs4_setup_sequence(data->seq_server, data->seq_args, |
568 | data->seq_res, data->cache_reply, task)) | 573 | data->seq_res, data->cache_reply, task)) |
569 | return; | 574 | return; |
570 | rpc_call_start(task); | 575 | rpc_call_start(task); |
@@ -593,8 +598,7 @@ struct rpc_call_ops nfs41_call_priv_sync_ops = { | |||
593 | .rpc_call_done = nfs41_call_sync_done, | 598 | .rpc_call_done = nfs41_call_sync_done, |
594 | }; | 599 | }; |
595 | 600 | ||
596 | static int nfs4_call_sync_sequence(struct nfs_client *clp, | 601 | static int nfs4_call_sync_sequence(struct nfs_server *server, |
597 | struct rpc_clnt *clnt, | ||
598 | struct rpc_message *msg, | 602 | struct rpc_message *msg, |
599 | struct nfs4_sequence_args *args, | 603 | struct nfs4_sequence_args *args, |
600 | struct nfs4_sequence_res *res, | 604 | struct nfs4_sequence_res *res, |
@@ -604,13 +608,13 @@ static int nfs4_call_sync_sequence(struct nfs_client *clp, | |||
604 | int ret; | 608 | int ret; |
605 | struct rpc_task *task; | 609 | struct rpc_task *task; |
606 | struct nfs41_call_sync_data data = { | 610 | struct nfs41_call_sync_data data = { |
607 | .clp = clp, | 611 | .seq_server = server, |
608 | .seq_args = args, | 612 | .seq_args = args, |
609 | .seq_res = res, | 613 | .seq_res = res, |
610 | .cache_reply = cache_reply, | 614 | .cache_reply = cache_reply, |
611 | }; | 615 | }; |
612 | struct rpc_task_setup task_setup = { | 616 | struct rpc_task_setup task_setup = { |
613 | .rpc_client = clnt, | 617 | .rpc_client = server->client, |
614 | .rpc_message = msg, | 618 | .rpc_message = msg, |
615 | .callback_ops = &nfs41_call_sync_ops, | 619 | .callback_ops = &nfs41_call_sync_ops, |
616 | .callback_data = &data | 620 | .callback_data = &data |
@@ -635,8 +639,7 @@ int _nfs4_call_sync_session(struct nfs_server *server, | |||
635 | struct nfs4_sequence_res *res, | 639 | struct nfs4_sequence_res *res, |
636 | int cache_reply) | 640 | int cache_reply) |
637 | { | 641 | { |
638 | return nfs4_call_sync_sequence(server->nfs_client, server->client, | 642 | return nfs4_call_sync_sequence(server, msg, args, res, cache_reply, 0); |
639 | msg, args, res, cache_reply, 0); | ||
640 | } | 643 | } |
641 | 644 | ||
642 | #endif /* CONFIG_NFS_V4_1 */ | 645 | #endif /* CONFIG_NFS_V4_1 */ |
@@ -1355,7 +1358,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
1355 | nfs_copy_fh(&data->o_res.fh, data->o_arg.fh); | 1358 | nfs_copy_fh(&data->o_res.fh, data->o_arg.fh); |
1356 | } | 1359 | } |
1357 | data->timestamp = jiffies; | 1360 | data->timestamp = jiffies; |
1358 | if (nfs4_setup_sequence(data->o_arg.server->nfs_client, | 1361 | if (nfs4_setup_sequence(data->o_arg.server, |
1359 | &data->o_arg.seq_args, | 1362 | &data->o_arg.seq_args, |
1360 | &data->o_res.seq_res, 1, task)) | 1363 | &data->o_res.seq_res, 1, task)) |
1361 | return; | 1364 | return; |
@@ -1896,7 +1899,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
1896 | 1899 | ||
1897 | nfs_fattr_init(calldata->res.fattr); | 1900 | nfs_fattr_init(calldata->res.fattr); |
1898 | calldata->timestamp = jiffies; | 1901 | calldata->timestamp = jiffies; |
1899 | if (nfs4_setup_sequence((NFS_SERVER(calldata->inode))->nfs_client, | 1902 | if (nfs4_setup_sequence(NFS_SERVER(calldata->inode), |
1900 | &calldata->arg.seq_args, &calldata->res.seq_res, | 1903 | &calldata->arg.seq_args, &calldata->res.seq_res, |
1901 | 1, task)) | 1904 | 1, task)) |
1902 | return; | 1905 | return; |
@@ -3660,7 +3663,7 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) | |||
3660 | 3663 | ||
3661 | d_data = (struct nfs4_delegreturndata *)data; | 3664 | d_data = (struct nfs4_delegreturndata *)data; |
3662 | 3665 | ||
3663 | if (nfs4_setup_sequence(d_data->res.server->nfs_client, | 3666 | if (nfs4_setup_sequence(d_data->res.server, |
3664 | &d_data->args.seq_args, | 3667 | &d_data->args.seq_args, |
3665 | &d_data->res.seq_res, 1, task)) | 3668 | &d_data->res.seq_res, 1, task)) |
3666 | return; | 3669 | return; |
@@ -3915,7 +3918,7 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) | |||
3915 | return; | 3918 | return; |
3916 | } | 3919 | } |
3917 | calldata->timestamp = jiffies; | 3920 | calldata->timestamp = jiffies; |
3918 | if (nfs4_setup_sequence(calldata->server->nfs_client, | 3921 | if (nfs4_setup_sequence(calldata->server, |
3919 | &calldata->arg.seq_args, | 3922 | &calldata->arg.seq_args, |
3920 | &calldata->res.seq_res, 1, task)) | 3923 | &calldata->res.seq_res, 1, task)) |
3921 | return; | 3924 | return; |
@@ -4070,7 +4073,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
4070 | } else | 4073 | } else |
4071 | data->arg.new_lock_owner = 0; | 4074 | data->arg.new_lock_owner = 0; |
4072 | data->timestamp = jiffies; | 4075 | data->timestamp = jiffies; |
4073 | if (nfs4_setup_sequence(data->server->nfs_client, &data->arg.seq_args, | 4076 | if (nfs4_setup_sequence(data->server, |
4077 | &data->arg.seq_args, | ||
4074 | &data->res.seq_res, 1, task)) | 4078 | &data->res.seq_res, 1, task)) |
4075 | return; | 4079 | return; |
4076 | rpc_call_start(task); | 4080 | rpc_call_start(task); |
@@ -5110,7 +5114,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data) | |||
5110 | args = task->tk_msg.rpc_argp; | 5114 | args = task->tk_msg.rpc_argp; |
5111 | res = task->tk_msg.rpc_resp; | 5115 | res = task->tk_msg.rpc_resp; |
5112 | 5116 | ||
5113 | if (nfs4_setup_sequence(clp, args, res, 0, task)) | 5117 | if (nfs41_setup_sequence(clp->cl_session, args, res, 0, task)) |
5114 | return; | 5118 | return; |
5115 | rpc_call_start(task); | 5119 | rpc_call_start(task); |
5116 | } | 5120 | } |
@@ -5195,7 +5199,8 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data) | |||
5195 | struct nfs4_reclaim_complete_data *calldata = data; | 5199 | struct nfs4_reclaim_complete_data *calldata = data; |
5196 | 5200 | ||
5197 | rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); | 5201 | rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); |
5198 | if (nfs4_setup_sequence(calldata->clp, &calldata->arg.seq_args, | 5202 | if (nfs41_setup_sequence(calldata->clp->cl_session, |
5203 | &calldata->arg.seq_args, | ||
5199 | &calldata->res.seq_res, 0, task)) | 5204 | &calldata->res.seq_res, 0, task)) |
5200 | return; | 5205 | return; |
5201 | 5206 | ||
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 6e2b06e6ca79..5a33a92e8168 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -410,7 +410,7 @@ void nfs_read_prepare(struct rpc_task *task, void *calldata) | |||
410 | { | 410 | { |
411 | struct nfs_read_data *data = calldata; | 411 | struct nfs_read_data *data = calldata; |
412 | 412 | ||
413 | if (nfs4_setup_sequence(NFS_SERVER(data->inode)->nfs_client, | 413 | if (nfs4_setup_sequence(NFS_SERVER(data->inode), |
414 | &data->args.seq_args, &data->res.seq_res, | 414 | &data->args.seq_args, &data->res.seq_res, |
415 | 0, task)) | 415 | 0, task)) |
416 | return; | 416 | return; |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index a2242af6a17d..2f84adaad427 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -110,7 +110,7 @@ void nfs_unlink_prepare(struct rpc_task *task, void *calldata) | |||
110 | struct nfs_unlinkdata *data = calldata; | 110 | struct nfs_unlinkdata *data = calldata; |
111 | struct nfs_server *server = NFS_SERVER(data->dir); | 111 | struct nfs_server *server = NFS_SERVER(data->dir); |
112 | 112 | ||
113 | if (nfs4_setup_sequence(server->nfs_client, &data->args.seq_args, | 113 | if (nfs4_setup_sequence(server, &data->args.seq_args, |
114 | &data->res.seq_res, 1, task)) | 114 | &data->res.seq_res, 1, task)) |
115 | return; | 115 | return; |
116 | rpc_call_start(task); | 116 | rpc_call_start(task); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 91679e2631ee..03df22822c4c 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1036,9 +1036,9 @@ out: | |||
1036 | void nfs_write_prepare(struct rpc_task *task, void *calldata) | 1036 | void nfs_write_prepare(struct rpc_task *task, void *calldata) |
1037 | { | 1037 | { |
1038 | struct nfs_write_data *data = calldata; | 1038 | struct nfs_write_data *data = calldata; |
1039 | struct nfs_client *clp = (NFS_SERVER(data->inode))->nfs_client; | ||
1040 | 1039 | ||
1041 | if (nfs4_setup_sequence(clp, &data->args.seq_args, | 1040 | if (nfs4_setup_sequence(NFS_SERVER(data->inode), |
1041 | &data->args.seq_args, | ||
1042 | &data->res.seq_res, 1, task)) | 1042 | &data->res.seq_res, 1, task)) |
1043 | return; | 1043 | return; |
1044 | rpc_call_start(task); | 1044 | rpc_call_start(task); |