diff options
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r-- | net/sunrpc/svcsock.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 5763e6460fea..7a2a90fb2e06 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -345,7 +345,6 @@ static void svc_sock_setbufsize(struct socket *sock, unsigned int snd, | |||
345 | lock_sock(sock->sk); | 345 | lock_sock(sock->sk); |
346 | sock->sk->sk_sndbuf = snd * 2; | 346 | sock->sk->sk_sndbuf = snd * 2; |
347 | sock->sk->sk_rcvbuf = rcv * 2; | 347 | sock->sk->sk_rcvbuf = rcv * 2; |
348 | sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK|SOCK_RCVBUF_LOCK; | ||
349 | release_sock(sock->sk); | 348 | release_sock(sock->sk); |
350 | #endif | 349 | #endif |
351 | } | 350 | } |
@@ -797,23 +796,6 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
797 | test_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags), | 796 | test_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags), |
798 | test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags)); | 797 | test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags)); |
799 | 798 | ||
800 | if (test_and_clear_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags)) | ||
801 | /* sndbuf needs to have room for one request | ||
802 | * per thread, otherwise we can stall even when the | ||
803 | * network isn't a bottleneck. | ||
804 | * | ||
805 | * We count all threads rather than threads in a | ||
806 | * particular pool, which provides an upper bound | ||
807 | * on the number of threads which will access the socket. | ||
808 | * | ||
809 | * rcvbuf just needs to be able to hold a few requests. | ||
810 | * Normally they will be removed from the queue | ||
811 | * as soon a a complete request arrives. | ||
812 | */ | ||
813 | svc_sock_setbufsize(svsk->sk_sock, | ||
814 | (serv->sv_nrthreads+3) * serv->sv_max_mesg, | ||
815 | 3 * serv->sv_max_mesg); | ||
816 | |||
817 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 799 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
818 | 800 | ||
819 | /* Receive data. If we haven't got the record length yet, get | 801 | /* Receive data. If we haven't got the record length yet, get |
@@ -1061,15 +1043,6 @@ static void svc_tcp_init(struct svc_sock *svsk, struct svc_serv *serv) | |||
1061 | 1043 | ||
1062 | tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; | 1044 | tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; |
1063 | 1045 | ||
1064 | /* initialise setting must have enough space to | ||
1065 | * receive and respond to one request. | ||
1066 | * svc_tcp_recvfrom will re-adjust if necessary | ||
1067 | */ | ||
1068 | svc_sock_setbufsize(svsk->sk_sock, | ||
1069 | 3 * svsk->sk_xprt.xpt_server->sv_max_mesg, | ||
1070 | 3 * svsk->sk_xprt.xpt_server->sv_max_mesg); | ||
1071 | |||
1072 | set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags); | ||
1073 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 1046 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
1074 | if (sk->sk_state != TCP_ESTABLISHED) | 1047 | if (sk->sk_state != TCP_ESTABLISHED) |
1075 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | 1048 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); |
@@ -1140,8 +1113,14 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, | |||
1140 | /* Initialize the socket */ | 1113 | /* Initialize the socket */ |
1141 | if (sock->type == SOCK_DGRAM) | 1114 | if (sock->type == SOCK_DGRAM) |
1142 | svc_udp_init(svsk, serv); | 1115 | svc_udp_init(svsk, serv); |
1143 | else | 1116 | else { |
1117 | /* initialise setting must have enough space to | ||
1118 | * receive and respond to one request. | ||
1119 | */ | ||
1120 | svc_sock_setbufsize(svsk->sk_sock, 4 * serv->sv_max_mesg, | ||
1121 | 4 * serv->sv_max_mesg); | ||
1144 | svc_tcp_init(svsk, serv); | 1122 | svc_tcp_init(svsk, serv); |
1123 | } | ||
1145 | 1124 | ||
1146 | /* | 1125 | /* |
1147 | * We start one listener per sv_serv. We want AF_INET | 1126 | * We start one listener per sv_serv. We want AF_INET |