aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2010-03-08 12:37:27 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2010-04-22 11:34:02 -0400
commit2bf23875f55af6038a5d1c164a52cec4c24609ba (patch)
treeb001fc6594833c6554c11836d23958c7c7049e35 /fs/nfsd
parentb12a05cbdfdf7e4d8cbe8fa78e995f971420086b (diff)
nfsd4: rearrange cb data structures
Mainly I just want to separate the arguments used for setting up the tcp client from the rest. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4callback.c25
-rw-r--r--fs/nfsd/nfs4state.c20
-rw-r--r--fs/nfsd/state.h11
3 files changed, 28 insertions, 28 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 5856fc8adb70..d6c46a9de422 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -455,7 +455,7 @@ static int max_cb_time(void)
455} 455}
456 456
457/* Reference counting, callback cleanup, etc., all look racy as heck. 457/* Reference counting, callback cleanup, etc., all look racy as heck.
458 * And why is cb_set an atomic? */ 458 * And why is cl_cb_set an atomic? */
459 459
460int setup_callback_client(struct nfs4_client *clp) 460int setup_callback_client(struct nfs4_client *clp)
461{ 461{
@@ -481,7 +481,7 @@ int setup_callback_client(struct nfs4_client *clp)
481 if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) 481 if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5))
482 return -EINVAL; 482 return -EINVAL;
483 if (cb->cb_minorversion) { 483 if (cb->cb_minorversion) {
484 args.bc_xprt = clp->cl_cb_xprt; 484 args.bc_xprt = clp->cl_cb_conn.cb_xprt;
485 args.protocol = XPRT_TRANSPORT_BC_TCP; 485 args.protocol = XPRT_TRANSPORT_BC_TCP;
486 } 486 }
487 /* Create RPC client */ 487 /* Create RPC client */
@@ -491,7 +491,7 @@ int setup_callback_client(struct nfs4_client *clp)
491 PTR_ERR(client)); 491 PTR_ERR(client));
492 return PTR_ERR(client); 492 return PTR_ERR(client);
493 } 493 }
494 cb->cb_client = client; 494 clp->cl_cb_client = client;
495 return 0; 495 return 0;
496 496
497} 497}
@@ -509,7 +509,7 @@ static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
509 if (task->tk_status) 509 if (task->tk_status)
510 warn_no_callback_path(clp, task->tk_status); 510 warn_no_callback_path(clp, task->tk_status);
511 else 511 else
512 atomic_set(&clp->cl_cb_conn.cb_set, 1); 512 atomic_set(&clp->cl_cb_set, 1);
513} 513}
514 514
515static const struct rpc_call_ops nfsd4_cb_probe_ops = { 515static const struct rpc_call_ops nfsd4_cb_probe_ops = {
@@ -531,7 +531,6 @@ int set_callback_cred(void)
531 531
532void do_probe_callback(struct nfs4_client *clp) 532void do_probe_callback(struct nfs4_client *clp)
533{ 533{
534 struct nfs4_cb_conn *cb = &clp->cl_cb_conn;
535 struct rpc_message msg = { 534 struct rpc_message msg = {
536 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], 535 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
537 .rpc_argp = clp, 536 .rpc_argp = clp,
@@ -539,7 +538,7 @@ void do_probe_callback(struct nfs4_client *clp)
539 }; 538 };
540 int status; 539 int status;
541 540
542 status = rpc_call_async(cb->cb_client, &msg, 541 status = rpc_call_async(clp->cl_cb_client, &msg,
543 RPC_TASK_SOFT | RPC_TASK_SOFTCONN, 542 RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
544 &nfsd4_cb_probe_ops, (void *)clp); 543 &nfsd4_cb_probe_ops, (void *)clp);
545 if (status) 544 if (status)
@@ -554,7 +553,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
554{ 553{
555 int status; 554 int status;
556 555
557 BUG_ON(atomic_read(&clp->cl_cb_conn.cb_set)); 556 BUG_ON(atomic_read(&clp->cl_cb_set));
558 557
559 status = setup_callback_client(clp); 558 status = setup_callback_client(clp);
560 if (status) { 559 if (status) {
@@ -656,7 +655,7 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
656 switch (task->tk_status) { 655 switch (task->tk_status) {
657 case -EIO: 656 case -EIO:
658 /* Network partition? */ 657 /* Network partition? */
659 atomic_set(&clp->cl_cb_conn.cb_set, 0); 658 atomic_set(&clp->cl_cb_set, 0);
660 warn_no_callback_path(clp, task->tk_status); 659 warn_no_callback_path(clp, task->tk_status);
661 case -EBADHANDLE: 660 case -EBADHANDLE:
662 case -NFS4ERR_BAD_STATEID: 661 case -NFS4ERR_BAD_STATEID:
@@ -673,7 +672,7 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
673 rpc_restart_call(task); 672 rpc_restart_call(task);
674 return; 673 return;
675 } else { 674 } else {
676 atomic_set(&clp->cl_cb_conn.cb_set, 0); 675 atomic_set(&clp->cl_cb_set, 0);
677 warn_no_callback_path(clp, task->tk_status); 676 warn_no_callback_path(clp, task->tk_status);
678 } 677 }
679} 678}
@@ -709,11 +708,11 @@ void nfsd4_destroy_callback_queue(void)
709void nfsd4_set_callback_client(struct nfs4_client *clp, struct rpc_clnt 708void nfsd4_set_callback_client(struct nfs4_client *clp, struct rpc_clnt
710*new) 709*new)
711{ 710{
712 struct rpc_clnt *old = clp->cl_cb_conn.cb_client; 711 struct rpc_clnt *old = clp->cl_cb_client;
713 712
714 clp->cl_cb_conn.cb_client = new; 713 clp->cl_cb_client = new;
715 /* 714 /*
716 * After this, any work that saw the old value of cb_client will 715 * After this, any work that saw the old value of cl_cb_client will
717 * be gone: 716 * be gone:
718 */ 717 */
719 flush_workqueue(callback_wq); 718 flush_workqueue(callback_wq);
@@ -728,7 +727,7 @@ void nfsd4_set_callback_client(struct nfs4_client *clp, struct rpc_clnt
728static void _nfsd4_cb_recall(struct nfs4_delegation *dp) 727static void _nfsd4_cb_recall(struct nfs4_delegation *dp)
729{ 728{
730 struct nfs4_client *clp = dp->dl_client; 729 struct nfs4_client *clp = dp->dl_client;
731 struct rpc_clnt *clnt = clp->cl_cb_conn.cb_client; 730 struct rpc_clnt *clnt = clp->cl_cb_client;
732 struct nfs4_rpc_args *args = &dp->dl_recall.cb_args; 731 struct nfs4_rpc_args *args = &dp->dl_recall.cb_args;
733 struct rpc_message msg = { 732 struct rpc_message msg = {
734 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], 733 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL],
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index cf650cbb814b..59c9bd4c89e1 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -726,8 +726,8 @@ expire_client(struct nfs4_client *clp)
726 release_session(ses); 726 release_session(ses);
727 } 727 }
728 nfsd4_set_callback_client(clp, NULL); 728 nfsd4_set_callback_client(clp, NULL);
729 if (clp->cl_cb_xprt) 729 if (clp->cl_cb_conn.cb_xprt)
730 svc_xprt_put(clp->cl_cb_xprt); 730 svc_xprt_put(clp->cl_cb_conn.cb_xprt);
731 free_client(clp); 731 free_client(clp);
732} 732}
733 733
@@ -814,7 +814,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir,
814 } 814 }
815 815
816 memcpy(clp->cl_recdir, recdir, HEXDIR_LEN); 816 memcpy(clp->cl_recdir, recdir, HEXDIR_LEN);
817 atomic_set(&clp->cl_cb_conn.cb_set, 0); 817 atomic_set(&clp->cl_cb_set, 0);
818 INIT_LIST_HEAD(&clp->cl_idhash); 818 INIT_LIST_HEAD(&clp->cl_idhash);
819 INIT_LIST_HEAD(&clp->cl_strhash); 819 INIT_LIST_HEAD(&clp->cl_strhash);
820 INIT_LIST_HEAD(&clp->cl_openowners); 820 INIT_LIST_HEAD(&clp->cl_openowners);
@@ -1302,8 +1302,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
1302 move_to_confirmed(unconf); 1302 move_to_confirmed(unconf);
1303 1303
1304 if (cr_ses->flags & SESSION4_BACK_CHAN) { 1304 if (cr_ses->flags & SESSION4_BACK_CHAN) {
1305 unconf->cl_cb_xprt = rqstp->rq_xprt; 1305 unconf->cl_cb_conn.cb_xprt = rqstp->rq_xprt;
1306 svc_xprt_get(unconf->cl_cb_xprt); 1306 svc_xprt_get(rqstp->rq_xprt);
1307 rpc_copy_addr( 1307 rpc_copy_addr(
1308 (struct sockaddr *)&unconf->cl_cb_conn.cb_addr, 1308 (struct sockaddr *)&unconf->cl_cb_conn.cb_addr,
1309 sa); 1309 sa);
@@ -1607,7 +1607,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
1607 else { 1607 else {
1608 /* XXX: We just turn off callbacks until we can handle 1608 /* XXX: We just turn off callbacks until we can handle
1609 * change request correctly. */ 1609 * change request correctly. */
1610 atomic_set(&conf->cl_cb_conn.cb_set, 0); 1610 atomic_set(&conf->cl_cb_set, 0);
1611 expire_client(unconf); 1611 expire_client(unconf);
1612 status = nfs_ok; 1612 status = nfs_ok;
1613 1613
@@ -2320,7 +2320,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
2320{ 2320{
2321 struct nfs4_delegation *dp; 2321 struct nfs4_delegation *dp;
2322 struct nfs4_stateowner *sop = stp->st_stateowner; 2322 struct nfs4_stateowner *sop = stp->st_stateowner;
2323 struct nfs4_cb_conn *cb = &sop->so_client->cl_cb_conn; 2323 int cb_up = atomic_read(&sop->so_client->cl_cb_set);
2324 struct file_lock fl, *flp = &fl; 2324 struct file_lock fl, *flp = &fl;
2325 int status, flag = 0; 2325 int status, flag = 0;
2326 2326
@@ -2328,7 +2328,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
2328 open->op_recall = 0; 2328 open->op_recall = 0;
2329 switch (open->op_claim_type) { 2329 switch (open->op_claim_type) {
2330 case NFS4_OPEN_CLAIM_PREVIOUS: 2330 case NFS4_OPEN_CLAIM_PREVIOUS:
2331 if (!atomic_read(&cb->cb_set)) 2331 if (!cb_up)
2332 open->op_recall = 1; 2332 open->op_recall = 1;
2333 flag = open->op_delegate_type; 2333 flag = open->op_delegate_type;
2334 if (flag == NFS4_OPEN_DELEGATE_NONE) 2334 if (flag == NFS4_OPEN_DELEGATE_NONE)
@@ -2339,7 +2339,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
2339 * had the chance to reclaim theirs.... */ 2339 * had the chance to reclaim theirs.... */
2340 if (locks_in_grace()) 2340 if (locks_in_grace())
2341 goto out; 2341 goto out;
2342 if (!atomic_read(&cb->cb_set) || !sop->so_confirmed) 2342 if (!cb_up || !sop->so_confirmed)
2343 goto out; 2343 goto out;
2344 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) 2344 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
2345 flag = NFS4_OPEN_DELEGATE_WRITE; 2345 flag = NFS4_OPEN_DELEGATE_WRITE;
@@ -2510,7 +2510,7 @@ nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2510 renew_client(clp); 2510 renew_client(clp);
2511 status = nfserr_cb_path_down; 2511 status = nfserr_cb_path_down;
2512 if (!list_empty(&clp->cl_delegations) 2512 if (!list_empty(&clp->cl_delegations)
2513 && !atomic_read(&clp->cl_cb_conn.cb_set)) 2513 && !atomic_read(&clp->cl_cb_set))
2514 goto out; 2514 goto out;
2515 status = nfs_ok; 2515 status = nfs_ok;
2516out: 2516out:
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index cef20abf330c..cf43812e6da5 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -107,9 +107,7 @@ struct nfs4_cb_conn {
107 u32 cb_prog; 107 u32 cb_prog;
108 u32 cb_minorversion; 108 u32 cb_minorversion;
109 u32 cb_ident; /* minorversion 0 only */ 109 u32 cb_ident; /* minorversion 0 only */
110 /* RPC client info */ 110 struct svc_xprt *cb_xprt; /* minorversion 1 only */
111 atomic_t cb_set; /* successful CB_NULL call */
112 struct rpc_clnt * cb_client;
113}; 111};
114 112
115/* Maximum number of slots per session. 160 is useful for long haul TCP */ 113/* Maximum number of slots per session. 160 is useful for long haul TCP */
@@ -223,9 +221,13 @@ struct nfs4_client {
223 struct svc_cred cl_cred; /* setclientid principal */ 221 struct svc_cred cl_cred; /* setclientid principal */
224 clientid_t cl_clientid; /* generated by server */ 222 clientid_t cl_clientid; /* generated by server */
225 nfs4_verifier cl_confirm; /* generated by server */ 223 nfs4_verifier cl_confirm; /* generated by server */
226 struct nfs4_cb_conn cl_cb_conn; /* callback info */
227 u32 cl_firststate; /* recovery dir creation */ 224 u32 cl_firststate; /* recovery dir creation */
228 225
226 /* for v4.0 and v4.1 callbacks: */
227 struct nfs4_cb_conn cl_cb_conn;
228 struct rpc_clnt *cl_cb_client;
229 atomic_t cl_cb_set;
230
229 /* for nfs41 */ 231 /* for nfs41 */
230 struct list_head cl_sessions; 232 struct list_head cl_sessions;
231 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ 233 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
@@ -236,7 +238,6 @@ struct nfs4_client {
236 /* We currently support a single back channel with a single slot */ 238 /* We currently support a single back channel with a single slot */
237 unsigned long cl_cb_slot_busy; 239 unsigned long cl_cb_slot_busy;
238 u32 cl_cb_seq_nr; 240 u32 cl_cb_seq_nr;
239 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
240 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ 241 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
241 /* wait here for slots */ 242 /* wait here for slots */
242}; 243};