diff options
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index e7c71a1ea3d4..ee6ffa01dfb1 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -108,7 +108,7 @@ int xprt_reserve_xprt(struct rpc_task *task) | |||
108 | return 1; | 108 | return 1; |
109 | 109 | ||
110 | out_sleep: | 110 | out_sleep: |
111 | dprintk("RPC: %4d failed to lock transport %p\n", | 111 | dprintk("RPC: %5u failed to lock transport %p\n", |
112 | task->tk_pid, xprt); | 112 | task->tk_pid, xprt); |
113 | task->tk_timeout = 0; | 113 | task->tk_timeout = 0; |
114 | task->tk_status = -EAGAIN; | 114 | task->tk_status = -EAGAIN; |
@@ -158,7 +158,7 @@ int xprt_reserve_xprt_cong(struct rpc_task *task) | |||
158 | } | 158 | } |
159 | xprt_clear_locked(xprt); | 159 | xprt_clear_locked(xprt); |
160 | out_sleep: | 160 | out_sleep: |
161 | dprintk("RPC: %4d failed to lock transport %p\n", task->tk_pid, xprt); | 161 | dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt); |
162 | task->tk_timeout = 0; | 162 | task->tk_timeout = 0; |
163 | task->tk_status = -EAGAIN; | 163 | task->tk_status = -EAGAIN; |
164 | if (req && req->rq_ntrans) | 164 | if (req && req->rq_ntrans) |
@@ -281,7 +281,7 @@ __xprt_get_cong(struct rpc_xprt *xprt, struct rpc_task *task) | |||
281 | 281 | ||
282 | if (req->rq_cong) | 282 | if (req->rq_cong) |
283 | return 1; | 283 | return 1; |
284 | dprintk("RPC: %4d xprt_cwnd_limited cong = %ld cwnd = %ld\n", | 284 | dprintk("RPC: %5u xprt_cwnd_limited cong = %lu cwnd = %lu\n", |
285 | task->tk_pid, xprt->cong, xprt->cwnd); | 285 | task->tk_pid, xprt->cong, xprt->cwnd); |
286 | if (RPCXPRT_CONGESTED(xprt)) | 286 | if (RPCXPRT_CONGESTED(xprt)) |
287 | return 0; | 287 | return 0; |
@@ -340,7 +340,7 @@ void xprt_adjust_cwnd(struct rpc_task *task, int result) | |||
340 | if (cwnd < RPC_CWNDSCALE) | 340 | if (cwnd < RPC_CWNDSCALE) |
341 | cwnd = RPC_CWNDSCALE; | 341 | cwnd = RPC_CWNDSCALE; |
342 | } | 342 | } |
343 | dprintk("RPC: cong %ld, cwnd was %ld, now %ld\n", | 343 | dprintk("RPC: cong %ld, cwnd was %ld, now %ld\n", |
344 | xprt->cong, xprt->cwnd, cwnd); | 344 | xprt->cong, xprt->cwnd, cwnd); |
345 | xprt->cwnd = cwnd; | 345 | xprt->cwnd = cwnd; |
346 | __xprt_put_cong(xprt, req); | 346 | __xprt_put_cong(xprt, req); |
@@ -387,8 +387,8 @@ void xprt_write_space(struct rpc_xprt *xprt) | |||
387 | 387 | ||
388 | spin_lock_bh(&xprt->transport_lock); | 388 | spin_lock_bh(&xprt->transport_lock); |
389 | if (xprt->snd_task) { | 389 | if (xprt->snd_task) { |
390 | dprintk("RPC: write space: waking waiting task on xprt %p\n", | 390 | dprintk("RPC: write space: waking waiting task on " |
391 | xprt); | 391 | "xprt %p\n", xprt); |
392 | rpc_wake_up_task(xprt->snd_task); | 392 | rpc_wake_up_task(xprt->snd_task); |
393 | } | 393 | } |
394 | spin_unlock_bh(&xprt->transport_lock); | 394 | spin_unlock_bh(&xprt->transport_lock); |
@@ -494,7 +494,7 @@ static void xprt_autoclose(struct work_struct *work) | |||
494 | */ | 494 | */ |
495 | void xprt_disconnect(struct rpc_xprt *xprt) | 495 | void xprt_disconnect(struct rpc_xprt *xprt) |
496 | { | 496 | { |
497 | dprintk("RPC: disconnected transport %p\n", xprt); | 497 | dprintk("RPC: disconnected transport %p\n", xprt); |
498 | spin_lock_bh(&xprt->transport_lock); | 498 | spin_lock_bh(&xprt->transport_lock); |
499 | xprt_clear_connected(xprt); | 499 | xprt_clear_connected(xprt); |
500 | xprt_wake_pending_tasks(xprt, -ENOTCONN); | 500 | xprt_wake_pending_tasks(xprt, -ENOTCONN); |
@@ -530,7 +530,7 @@ void xprt_connect(struct rpc_task *task) | |||
530 | { | 530 | { |
531 | struct rpc_xprt *xprt = task->tk_xprt; | 531 | struct rpc_xprt *xprt = task->tk_xprt; |
532 | 532 | ||
533 | dprintk("RPC: %4d xprt_connect xprt %p %s connected\n", task->tk_pid, | 533 | dprintk("RPC: %5u xprt_connect xprt %p %s connected\n", task->tk_pid, |
534 | xprt, (xprt_connected(xprt) ? "is" : "is not")); | 534 | xprt, (xprt_connected(xprt) ? "is" : "is not")); |
535 | 535 | ||
536 | if (!xprt_bound(xprt)) { | 536 | if (!xprt_bound(xprt)) { |
@@ -560,7 +560,7 @@ static void xprt_connect_status(struct rpc_task *task) | |||
560 | if (task->tk_status >= 0) { | 560 | if (task->tk_status >= 0) { |
561 | xprt->stat.connect_count++; | 561 | xprt->stat.connect_count++; |
562 | xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start; | 562 | xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start; |
563 | dprintk("RPC: %4d xprt_connect_status: connection established\n", | 563 | dprintk("RPC: %5u xprt_connect_status: connection established\n", |
564 | task->tk_pid); | 564 | task->tk_pid); |
565 | return; | 565 | return; |
566 | } | 566 | } |
@@ -568,20 +568,22 @@ static void xprt_connect_status(struct rpc_task *task) | |||
568 | switch (task->tk_status) { | 568 | switch (task->tk_status) { |
569 | case -ECONNREFUSED: | 569 | case -ECONNREFUSED: |
570 | case -ECONNRESET: | 570 | case -ECONNRESET: |
571 | dprintk("RPC: %4d xprt_connect_status: server %s refused connection\n", | 571 | dprintk("RPC: %5u xprt_connect_status: server %s refused " |
572 | task->tk_pid, task->tk_client->cl_server); | 572 | "connection\n", task->tk_pid, |
573 | task->tk_client->cl_server); | ||
573 | break; | 574 | break; |
574 | case -ENOTCONN: | 575 | case -ENOTCONN: |
575 | dprintk("RPC: %4d xprt_connect_status: connection broken\n", | 576 | dprintk("RPC: %5u xprt_connect_status: connection broken\n", |
576 | task->tk_pid); | 577 | task->tk_pid); |
577 | break; | 578 | break; |
578 | case -ETIMEDOUT: | 579 | case -ETIMEDOUT: |
579 | dprintk("RPC: %4d xprt_connect_status: connect attempt timed out\n", | 580 | dprintk("RPC: %5u xprt_connect_status: connect attempt timed " |
580 | task->tk_pid); | 581 | "out\n", task->tk_pid); |
581 | break; | 582 | break; |
582 | default: | 583 | default: |
583 | dprintk("RPC: %4d xprt_connect_status: error %d connecting to server %s\n", | 584 | dprintk("RPC: %5u xprt_connect_status: error %d connecting to " |
584 | task->tk_pid, -task->tk_status, task->tk_client->cl_server); | 585 | "server %s\n", task->tk_pid, -task->tk_status, |
586 | task->tk_client->cl_server); | ||
585 | xprt_release_write(xprt, task); | 587 | xprt_release_write(xprt, task); |
586 | task->tk_status = -EIO; | 588 | task->tk_status = -EIO; |
587 | } | 589 | } |
@@ -602,6 +604,9 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) | |||
602 | if (entry->rq_xid == xid) | 604 | if (entry->rq_xid == xid) |
603 | return entry; | 605 | return entry; |
604 | } | 606 | } |
607 | |||
608 | dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n", | ||
609 | ntohl(xid)); | ||
605 | xprt->stat.bad_xids++; | 610 | xprt->stat.bad_xids++; |
606 | return NULL; | 611 | return NULL; |
607 | } | 612 | } |
@@ -654,7 +659,7 @@ static void xprt_timer(struct rpc_task *task) | |||
654 | struct rpc_rqst *req = task->tk_rqstp; | 659 | struct rpc_rqst *req = task->tk_rqstp; |
655 | struct rpc_xprt *xprt = req->rq_xprt; | 660 | struct rpc_xprt *xprt = req->rq_xprt; |
656 | 661 | ||
657 | dprintk("RPC: %4d xprt_timer\n", task->tk_pid); | 662 | dprintk("RPC: %5u xprt_timer\n", task->tk_pid); |
658 | 663 | ||
659 | spin_lock(&xprt->transport_lock); | 664 | spin_lock(&xprt->transport_lock); |
660 | if (!req->rq_received) { | 665 | if (!req->rq_received) { |
@@ -678,7 +683,7 @@ int xprt_prepare_transmit(struct rpc_task *task) | |||
678 | struct rpc_xprt *xprt = req->rq_xprt; | 683 | struct rpc_xprt *xprt = req->rq_xprt; |
679 | int err = 0; | 684 | int err = 0; |
680 | 685 | ||
681 | dprintk("RPC: %4d xprt_prepare_transmit\n", task->tk_pid); | 686 | dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid); |
682 | 687 | ||
683 | spin_lock_bh(&xprt->transport_lock); | 688 | spin_lock_bh(&xprt->transport_lock); |
684 | if (req->rq_received && !req->rq_bytes_sent) { | 689 | if (req->rq_received && !req->rq_bytes_sent) { |
@@ -716,7 +721,7 @@ void xprt_transmit(struct rpc_task *task) | |||
716 | struct rpc_xprt *xprt = req->rq_xprt; | 721 | struct rpc_xprt *xprt = req->rq_xprt; |
717 | int status; | 722 | int status; |
718 | 723 | ||
719 | dprintk("RPC: %4d xprt_transmit(%u)\n", task->tk_pid, req->rq_slen); | 724 | dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen); |
720 | 725 | ||
721 | if (!req->rq_received) { | 726 | if (!req->rq_received) { |
722 | if (list_empty(&req->rq_list)) { | 727 | if (list_empty(&req->rq_list)) { |
@@ -730,13 +735,23 @@ void xprt_transmit(struct rpc_task *task) | |||
730 | xprt_reset_majortimeo(req); | 735 | xprt_reset_majortimeo(req); |
731 | /* Turn off autodisconnect */ | 736 | /* Turn off autodisconnect */ |
732 | del_singleshot_timer_sync(&xprt->timer); | 737 | del_singleshot_timer_sync(&xprt->timer); |
738 | } else { | ||
739 | /* If all request bytes have been sent, | ||
740 | * then we must be retransmitting this one */ | ||
741 | if (!req->rq_bytes_sent) { | ||
742 | if (task->tk_client->cl_discrtry) { | ||
743 | xprt_disconnect(xprt); | ||
744 | task->tk_status = -ENOTCONN; | ||
745 | return; | ||
746 | } | ||
747 | } | ||
733 | } | 748 | } |
734 | } else if (!req->rq_bytes_sent) | 749 | } else if (!req->rq_bytes_sent) |
735 | return; | 750 | return; |
736 | 751 | ||
737 | status = xprt->ops->send_request(task); | 752 | status = xprt->ops->send_request(task); |
738 | if (status == 0) { | 753 | if (status == 0) { |
739 | dprintk("RPC: %4d xmit complete\n", task->tk_pid); | 754 | dprintk("RPC: %5u xmit complete\n", task->tk_pid); |
740 | spin_lock_bh(&xprt->transport_lock); | 755 | spin_lock_bh(&xprt->transport_lock); |
741 | 756 | ||
742 | xprt->ops->set_retrans_timeout(task); | 757 | xprt->ops->set_retrans_timeout(task); |
@@ -777,7 +792,7 @@ static inline void do_xprt_reserve(struct rpc_task *task) | |||
777 | xprt_request_init(task, xprt); | 792 | xprt_request_init(task, xprt); |
778 | return; | 793 | return; |
779 | } | 794 | } |
780 | dprintk("RPC: waiting for request slot\n"); | 795 | dprintk("RPC: waiting for request slot\n"); |
781 | task->tk_status = -EAGAIN; | 796 | task->tk_status = -EAGAIN; |
782 | task->tk_timeout = 0; | 797 | task->tk_timeout = 0; |
783 | rpc_sleep_on(&xprt->backlog, task, NULL, NULL); | 798 | rpc_sleep_on(&xprt->backlog, task, NULL, NULL); |
@@ -822,7 +837,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) | |||
822 | req->rq_xid = xprt_alloc_xid(xprt); | 837 | req->rq_xid = xprt_alloc_xid(xprt); |
823 | req->rq_release_snd_buf = NULL; | 838 | req->rq_release_snd_buf = NULL; |
824 | xprt_reset_majortimeo(req); | 839 | xprt_reset_majortimeo(req); |
825 | dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid, | 840 | dprintk("RPC: %5u reserved req %p xid %08x\n", task->tk_pid, |
826 | req, ntohl(req->rq_xid)); | 841 | req, ntohl(req->rq_xid)); |
827 | } | 842 | } |
828 | 843 | ||
@@ -856,7 +871,7 @@ void xprt_release(struct rpc_task *task) | |||
856 | req->rq_release_snd_buf(req); | 871 | req->rq_release_snd_buf(req); |
857 | memset(req, 0, sizeof(*req)); /* mark unused */ | 872 | memset(req, 0, sizeof(*req)); /* mark unused */ |
858 | 873 | ||
859 | dprintk("RPC: %4d release request %p\n", task->tk_pid, req); | 874 | dprintk("RPC: %5u release request %p\n", task->tk_pid, req); |
860 | 875 | ||
861 | spin_lock(&xprt->reserve_lock); | 876 | spin_lock(&xprt->reserve_lock); |
862 | list_add(&req->rq_list, &xprt->free); | 877 | list_add(&req->rq_list, &xprt->free); |
@@ -906,7 +921,7 @@ struct rpc_xprt *xprt_create_transport(int proto, struct sockaddr *ap, size_t si | |||
906 | return ERR_PTR(-EIO); | 921 | return ERR_PTR(-EIO); |
907 | } | 922 | } |
908 | if (IS_ERR(xprt)) { | 923 | if (IS_ERR(xprt)) { |
909 | dprintk("RPC: xprt_create_transport: failed, %ld\n", | 924 | dprintk("RPC: xprt_create_transport: failed, %ld\n", |
910 | -PTR_ERR(xprt)); | 925 | -PTR_ERR(xprt)); |
911 | return xprt; | 926 | return xprt; |
912 | } | 927 | } |
@@ -936,7 +951,7 @@ struct rpc_xprt *xprt_create_transport(int proto, struct sockaddr *ap, size_t si | |||
936 | 951 | ||
937 | xprt_init_xid(xprt); | 952 | xprt_init_xid(xprt); |
938 | 953 | ||
939 | dprintk("RPC: created transport %p with %u slots\n", xprt, | 954 | dprintk("RPC: created transport %p with %u slots\n", xprt, |
940 | xprt->max_reqs); | 955 | xprt->max_reqs); |
941 | 956 | ||
942 | return xprt; | 957 | return xprt; |
@@ -951,7 +966,7 @@ static void xprt_destroy(struct kref *kref) | |||
951 | { | 966 | { |
952 | struct rpc_xprt *xprt = container_of(kref, struct rpc_xprt, kref); | 967 | struct rpc_xprt *xprt = container_of(kref, struct rpc_xprt, kref); |
953 | 968 | ||
954 | dprintk("RPC: destroying transport %p\n", xprt); | 969 | dprintk("RPC: destroying transport %p\n", xprt); |
955 | xprt->shutdown = 1; | 970 | xprt->shutdown = 1; |
956 | del_timer_sync(&xprt->timer); | 971 | del_timer_sync(&xprt->timer); |
957 | 972 | ||