diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-06-15 21:08:07 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-06-15 21:08:07 -0400 |
commit | 7eef4091a653c243a87e5375c54504cc03bec4d8 (patch) | |
tree | f65b77f830b2c8f7d014512badfef5df0d591ee9 /net/sunrpc/svcsock.c | |
parent | 0a93a47f042c459f0f46942c3a920e3c81878031 (diff) | |
parent | 07a2039b8eb0af4ff464efd3dfd95de5c02648c6 (diff) |
Merge commit 'v2.6.30' into for-2.6.31
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r-- | net/sunrpc/svcsock.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 4e6d406264a0..004a2f9dc432 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -379,6 +379,7 @@ static void svc_sock_setbufsize(struct socket *sock, unsigned int snd, | |||
379 | lock_sock(sock->sk); | 379 | lock_sock(sock->sk); |
380 | sock->sk->sk_sndbuf = snd * 2; | 380 | sock->sk->sk_sndbuf = snd * 2; |
381 | sock->sk->sk_rcvbuf = rcv * 2; | 381 | sock->sk->sk_rcvbuf = rcv * 2; |
382 | sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK|SOCK_RCVBUF_LOCK; | ||
382 | release_sock(sock->sk); | 383 | release_sock(sock->sk); |
383 | #endif | 384 | #endif |
384 | } | 385 | } |
@@ -831,6 +832,23 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
831 | test_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags), | 832 | test_bit(XPT_CONN, &svsk->sk_xprt.xpt_flags), |
832 | test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags)); | 833 | test_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags)); |
833 | 834 | ||
835 | if (test_and_clear_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags)) | ||
836 | /* sndbuf needs to have room for one request | ||
837 | * per thread, otherwise we can stall even when the | ||
838 | * network isn't a bottleneck. | ||
839 | * | ||
840 | * We count all threads rather than threads in a | ||
841 | * particular pool, which provides an upper bound | ||
842 | * on the number of threads which will access the socket. | ||
843 | * | ||
844 | * rcvbuf just needs to be able to hold a few requests. | ||
845 | * Normally they will be removed from the queue | ||
846 | * as soon a a complete request arrives. | ||
847 | */ | ||
848 | svc_sock_setbufsize(svsk->sk_sock, | ||
849 | (serv->sv_nrthreads+3) * serv->sv_max_mesg, | ||
850 | 3 * serv->sv_max_mesg); | ||
851 | |||
834 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 852 | clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
835 | 853 | ||
836 | /* Receive data. If we haven't got the record length yet, get | 854 | /* Receive data. If we haven't got the record length yet, get |
@@ -1078,6 +1096,15 @@ static void svc_tcp_init(struct svc_sock *svsk, struct svc_serv *serv) | |||
1078 | 1096 | ||
1079 | tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; | 1097 | tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; |
1080 | 1098 | ||
1099 | /* initialise setting must have enough space to | ||
1100 | * receive and respond to one request. | ||
1101 | * svc_tcp_recvfrom will re-adjust if necessary | ||
1102 | */ | ||
1103 | svc_sock_setbufsize(svsk->sk_sock, | ||
1104 | 3 * svsk->sk_xprt.xpt_server->sv_max_mesg, | ||
1105 | 3 * svsk->sk_xprt.xpt_server->sv_max_mesg); | ||
1106 | |||
1107 | set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags); | ||
1081 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 1108 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
1082 | if (sk->sk_state != TCP_ESTABLISHED) | 1109 | if (sk->sk_state != TCP_ESTABLISHED) |
1083 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | 1110 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); |
@@ -1147,14 +1174,8 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, | |||
1147 | /* Initialize the socket */ | 1174 | /* Initialize the socket */ |
1148 | if (sock->type == SOCK_DGRAM) | 1175 | if (sock->type == SOCK_DGRAM) |
1149 | svc_udp_init(svsk, serv); | 1176 | svc_udp_init(svsk, serv); |
1150 | else { | 1177 | else |
1151 | /* initialise setting must have enough space to | ||
1152 | * receive and respond to one request. | ||
1153 | */ | ||
1154 | svc_sock_setbufsize(svsk->sk_sock, 4 * serv->sv_max_mesg, | ||
1155 | 4 * serv->sv_max_mesg); | ||
1156 | svc_tcp_init(svsk, serv); | 1178 | svc_tcp_init(svsk, serv); |
1157 | } | ||
1158 | 1179 | ||
1159 | dprintk("svc: svc_setup_socket created %p (inet %p)\n", | 1180 | dprintk("svc: svc_setup_socket created %p (inet %p)\n", |
1160 | svsk, svsk->sk_sk); | 1181 | svsk, svsk->sk_sk); |