aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index aaf053b1a0c4..5bb6fed3df34 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -356,6 +356,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
356 default: 356 default:
357 dprintk("RPC: sendmsg returned unrecognized error %d\n", 357 dprintk("RPC: sendmsg returned unrecognized error %d\n",
358 -status); 358 -status);
359 xprt_disconnect(xprt);
359 break; 360 break;
360 } 361 }
361 362
@@ -826,19 +827,17 @@ static void xs_tcp_write_space(struct sock *sk)
826} 827}
827 828
828/** 829/**
829 * xs_set_buffer_size - set send and receive limits 830 * xs_udp_set_buffer_size - set send and receive limits
830 * @xprt: generic transport 831 * @xprt: generic transport
831 * 832 *
832 * Set socket send and receive limits based on the 833 * Set socket send and receive limits based on the
833 * sndsize and rcvsize fields in the generic transport 834 * sndsize and rcvsize fields in the generic transport
834 * structure. This applies only to UDP sockets. 835 * structure.
835 */ 836 */
836static void xs_set_buffer_size(struct rpc_xprt *xprt) 837static void xs_udp_set_buffer_size(struct rpc_xprt *xprt)
837{ 838{
838 struct sock *sk = xprt->inet; 839 struct sock *sk = xprt->inet;
839 840
840 if (xprt->stream)
841 return;
842 if (xprt->rcvsize) { 841 if (xprt->rcvsize) {
843 sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 842 sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
844 sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2; 843 sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2;
@@ -850,6 +849,17 @@ static void xs_set_buffer_size(struct rpc_xprt *xprt)
850 } 849 }
851} 850}
852 851
852/**
853 * xs_tcp_set_buffer_size - set send and receive limits
854 * @xprt: generic transport
855 *
856 * Nothing to do for TCP.
857 */
858static void xs_tcp_set_buffer_size(struct rpc_xprt *xprt)
859{
860 return;
861}
862
853static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) 863static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock)
854{ 864{
855 struct sockaddr_in myaddr = { 865 struct sockaddr_in myaddr = {
@@ -928,7 +938,7 @@ static void xs_udp_connect_worker(void *args)
928 938
929 write_unlock_bh(&sk->sk_callback_lock); 939 write_unlock_bh(&sk->sk_callback_lock);
930 } 940 }
931 xs_set_buffer_size(xprt); 941 xs_udp_set_buffer_size(xprt);
932 status = 0; 942 status = 0;
933out: 943out:
934 xprt_wake_pending_tasks(xprt, status); 944 xprt_wake_pending_tasks(xprt, status);
@@ -1034,7 +1044,7 @@ static void xs_connect(struct rpc_task *task)
1034} 1044}
1035 1045
1036static struct rpc_xprt_ops xs_udp_ops = { 1046static struct rpc_xprt_ops xs_udp_ops = {
1037 .set_buffer_size = xs_set_buffer_size, 1047 .set_buffer_size = xs_udp_set_buffer_size,
1038 .connect = xs_connect, 1048 .connect = xs_connect,
1039 .send_request = xs_udp_send_request, 1049 .send_request = xs_udp_send_request,
1040 .close = xs_close, 1050 .close = xs_close,
@@ -1042,7 +1052,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
1042}; 1052};
1043 1053
1044static struct rpc_xprt_ops xs_tcp_ops = { 1054static struct rpc_xprt_ops xs_tcp_ops = {
1045 .set_buffer_size = xs_set_buffer_size, 1055 .set_buffer_size = xs_tcp_set_buffer_size,
1046 .connect = xs_connect, 1056 .connect = xs_connect,
1047 .send_request = xs_tcp_send_request, 1057 .send_request = xs_tcp_send_request,
1048 .close = xs_close, 1058 .close = xs_close,
@@ -1074,7 +1084,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1074 xprt->prot = IPPROTO_UDP; 1084 xprt->prot = IPPROTO_UDP;
1075 xprt->port = XS_MAX_RESVPORT; 1085 xprt->port = XS_MAX_RESVPORT;
1076 xprt->tsh_size = 0; 1086 xprt->tsh_size = 0;
1077 xprt->stream = 0;
1078 xprt->nocong = 0; 1087 xprt->nocong = 0;
1079 xprt->cwnd = RPC_INITCWND; 1088 xprt->cwnd = RPC_INITCWND;
1080 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; 1089 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
@@ -1115,7 +1124,6 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1115 xprt->prot = IPPROTO_TCP; 1124 xprt->prot = IPPROTO_TCP;
1116 xprt->port = XS_MAX_RESVPORT; 1125 xprt->port = XS_MAX_RESVPORT;
1117 xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); 1126 xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32);
1118 xprt->stream = 1;
1119 xprt->nocong = 1; 1127 xprt->nocong = 1;
1120 xprt->cwnd = RPC_MAXCWND(xprt); 1128 xprt->cwnd = RPC_MAXCWND(xprt);
1121 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; 1129 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;