aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 03:54:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 03:54:24 -0500
commit85004cc367abc000aa36c0d0e270ab609a68b0cb (patch)
tree5739aae778d67b6d119fe5c668313fc2823e9836 /net/sunrpc/xprt.c
parent149a051f82d2b3860fe32fa182dbc83a66274894 (diff)
parent3fbd67ad61f6d5a09ea717b56c50bc5c3d8042a8 (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (118 commits) NFSv4: Iterate through all nfs_clients when the server recalls a delegation NFSv4: Deal more correctly with duplicate delegations NFS: Fix a potential race between umount and nfs_access_cache_shrinker() NFS: Add an asynchronous delegreturn operation for use in nfs_clear_inode nfs: convert NFS_*(inode) helpers to static inline nfs: obliterate NFS_FLAGS macro NFS: Address memory leaks in the NFS client mount option parser nfs4: allow nfsv4 acls on non-regular-files NFS: Optimise away the sigmask code in aio/dio reads and writes SUNRPC: Don't bother changing the sigmask for asynchronous RPC calls SUNRPC: rpcb_getport_sync() passes incorrect address size to rpc_create() SUNRPC: Clean up block comment preceding rpcb_getport_sync() SUNRPC: Use appropriate argument types in rpcb client SUNRPC: rpcb_getport_sync() should use built-in hostname generator SUNRPC: Clean up functions that free address_strings array NFS: NFS version number is unsigned NLM: Fix a bogus 'return' in nlmclnt_rpc_release NLM: Introduce an arguments structure for nlmclnt_init() NLM/NFS: Use cached nlm_host when calling nlmclnt_proc() NFS: Invoke nlmclnt_init during NFS mount processing ...
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r--net/sunrpc/xprt.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index fb92f51405c5..cfcade906a56 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -501,9 +501,10 @@ EXPORT_SYMBOL_GPL(xprt_set_retrans_timeout_def);
501void xprt_set_retrans_timeout_rtt(struct rpc_task *task) 501void xprt_set_retrans_timeout_rtt(struct rpc_task *task)
502{ 502{
503 int timer = task->tk_msg.rpc_proc->p_timer; 503 int timer = task->tk_msg.rpc_proc->p_timer;
504 struct rpc_rtt *rtt = task->tk_client->cl_rtt; 504 struct rpc_clnt *clnt = task->tk_client;
505 struct rpc_rtt *rtt = clnt->cl_rtt;
505 struct rpc_rqst *req = task->tk_rqstp; 506 struct rpc_rqst *req = task->tk_rqstp;
506 unsigned long max_timeout = req->rq_xprt->timeout.to_maxval; 507 unsigned long max_timeout = clnt->cl_timeout->to_maxval;
507 508
508 task->tk_timeout = rpc_calc_rto(rtt, timer); 509 task->tk_timeout = rpc_calc_rto(rtt, timer);
509 task->tk_timeout <<= rpc_ntimeo(rtt, timer) + req->rq_retries; 510 task->tk_timeout <<= rpc_ntimeo(rtt, timer) + req->rq_retries;
@@ -514,7 +515,7 @@ EXPORT_SYMBOL_GPL(xprt_set_retrans_timeout_rtt);
514 515
515static void xprt_reset_majortimeo(struct rpc_rqst *req) 516static void xprt_reset_majortimeo(struct rpc_rqst *req)
516{ 517{
517 struct rpc_timeout *to = &req->rq_xprt->timeout; 518 const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout;
518 519
519 req->rq_majortimeo = req->rq_timeout; 520 req->rq_majortimeo = req->rq_timeout;
520 if (to->to_exponential) 521 if (to->to_exponential)
@@ -534,7 +535,7 @@ static void xprt_reset_majortimeo(struct rpc_rqst *req)
534int xprt_adjust_timeout(struct rpc_rqst *req) 535int xprt_adjust_timeout(struct rpc_rqst *req)
535{ 536{
536 struct rpc_xprt *xprt = req->rq_xprt; 537 struct rpc_xprt *xprt = req->rq_xprt;
537 struct rpc_timeout *to = &xprt->timeout; 538 const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout;
538 int status = 0; 539 int status = 0;
539 540
540 if (time_before(jiffies, req->rq_majortimeo)) { 541 if (time_before(jiffies, req->rq_majortimeo)) {
@@ -568,17 +569,17 @@ static void xprt_autoclose(struct work_struct *work)
568 struct rpc_xprt *xprt = 569 struct rpc_xprt *xprt =
569 container_of(work, struct rpc_xprt, task_cleanup); 570 container_of(work, struct rpc_xprt, task_cleanup);
570 571
571 xprt_disconnect(xprt);
572 xprt->ops->close(xprt); 572 xprt->ops->close(xprt);
573 clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
573 xprt_release_write(xprt, NULL); 574 xprt_release_write(xprt, NULL);
574} 575}
575 576
576/** 577/**
577 * xprt_disconnect - mark a transport as disconnected 578 * xprt_disconnect_done - mark a transport as disconnected
578 * @xprt: transport to flag for disconnect 579 * @xprt: transport to flag for disconnect
579 * 580 *
580 */ 581 */
581void xprt_disconnect(struct rpc_xprt *xprt) 582void xprt_disconnect_done(struct rpc_xprt *xprt)
582{ 583{
583 dprintk("RPC: disconnected transport %p\n", xprt); 584 dprintk("RPC: disconnected transport %p\n", xprt);
584 spin_lock_bh(&xprt->transport_lock); 585 spin_lock_bh(&xprt->transport_lock);
@@ -586,7 +587,26 @@ void xprt_disconnect(struct rpc_xprt *xprt)
586 xprt_wake_pending_tasks(xprt, -ENOTCONN); 587 xprt_wake_pending_tasks(xprt, -ENOTCONN);
587 spin_unlock_bh(&xprt->transport_lock); 588 spin_unlock_bh(&xprt->transport_lock);
588} 589}
589EXPORT_SYMBOL_GPL(xprt_disconnect); 590EXPORT_SYMBOL_GPL(xprt_disconnect_done);
591
592/**
593 * xprt_force_disconnect - force a transport to disconnect
594 * @xprt: transport to disconnect
595 *
596 */
597void xprt_force_disconnect(struct rpc_xprt *xprt)
598{
599 /* Don't race with the test_bit() in xprt_clear_locked() */
600 spin_lock_bh(&xprt->transport_lock);
601 set_bit(XPRT_CLOSE_WAIT, &xprt->state);
602 /* Try to schedule an autoclose RPC call */
603 if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
604 queue_work(rpciod_workqueue, &xprt->task_cleanup);
605 else if (xprt->snd_task != NULL)
606 rpc_wake_up_task(xprt->snd_task);
607 spin_unlock_bh(&xprt->transport_lock);
608}
609EXPORT_SYMBOL_GPL(xprt_force_disconnect);
590 610
591static void 611static void
592xprt_init_autodisconnect(unsigned long data) 612xprt_init_autodisconnect(unsigned long data)
@@ -909,7 +929,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
909{ 929{
910 struct rpc_rqst *req = task->tk_rqstp; 930 struct rpc_rqst *req = task->tk_rqstp;
911 931
912 req->rq_timeout = xprt->timeout.to_initval; 932 req->rq_timeout = task->tk_client->cl_timeout->to_initval;
913 req->rq_task = task; 933 req->rq_task = task;
914 req->rq_xprt = xprt; 934 req->rq_xprt = xprt;
915 req->rq_buffer = NULL; 935 req->rq_buffer = NULL;
@@ -959,22 +979,6 @@ void xprt_release(struct rpc_task *task)
959} 979}
960 980
961/** 981/**
962 * xprt_set_timeout - set constant RPC timeout
963 * @to: RPC timeout parameters to set up
964 * @retr: number of retries
965 * @incr: amount of increase after each retry
966 *
967 */
968void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr)
969{
970 to->to_initval =
971 to->to_increment = incr;
972 to->to_maxval = to->to_initval + (incr * retr);
973 to->to_retries = retr;
974 to->to_exponential = 0;
975}
976
977/**
978 * xprt_create_transport - create an RPC transport 982 * xprt_create_transport - create an RPC transport
979 * @args: rpc transport creation arguments 983 * @args: rpc transport creation arguments
980 * 984 *