Linux NFS development
 help / color / mirror / Atom feed
From: Olga Kornievskaia <aglo@citi.umich.edu>
To: linux-nfs@vger.kernel.org
Subject: [PATCH] NFSD: fix use of setsockopt
Date: Thu, 19 Jun 2008 09:33:39 -0400	[thread overview]
Message-ID: <485A6033.3090301@citi.umich.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

The following patch fixes NFS server's use of setsockopt. For this 
function to take an effect it first needs be called after socket 
creation but before sock binding.

This patch also changes the size of the receive sock buffer to be same 
as the send sock buffer. Both buffers are now a multiple of maxpayload 
and number of nfsd threads.

This patch fixes the problem that receive window never opens beyond the 
default TCP receive window size set by the 2nd parameter of the 
net.ipv4.tcp_rmem sysctl.

Signed-off-by: Olga Kornievskaia <aglo@citi.umich.edu>

[-- Attachment #2: nfsd-fix-sockopt-7.patch --]
[-- Type: text/x-patch, Size: 1242 bytes --]

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index c75bffe..178b397 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1191,7 +1191,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
 		 */
 		svc_sock_setbufsize(svsk->sk_sock,
 				    (serv->sv_nrthreads+3) * serv->sv_max_mesg,
-				    3 * serv->sv_max_mesg);
+				    (serv->sv_nrthreads+3) * serv->sv_max_mesg);
 
 	clear_bit(SK_DATA, &svsk->sk_flags);
 
@@ -1372,11 +1372,6 @@ svc_tcp_init(struct svc_sock *svsk)
 		 * receive and respond to one request.
 		 * svc_tcp_recvfrom will re-adjust if necessary
 		 */
-		svc_sock_setbufsize(svsk->sk_sock,
-				    3 * svsk->sk_server->sv_max_mesg,
-				    3 * svsk->sk_server->sv_max_mesg);
-
-		set_bit(SK_CHNGBUF, &svsk->sk_flags);
 		set_bit(SK_DATA, &svsk->sk_flags);
 		if (sk->sk_state != TCP_ESTABLISHED)
 			set_bit(SK_CLOSE, &svsk->sk_flags);
@@ -1761,6 +1756,8 @@ static int svc_create_socket(struct svc_serv *serv, int protocol,
 
 	if (type == SOCK_STREAM)
 		sock->sk->sk_reuse = 1;		/* allow address reuse */
+	svc_sock_setbufsize(sock, (serv->sv_nrthreads+3) * serv->sv_max_mesg,
+				(serv->sv_nrthreads+3) * serv->sv_max_mesg);
 	error = kernel_bind(sock, sin, len);
 	if (error < 0)
 		goto bummer;

             reply	other threads:[~2008-06-19 13:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 13:33 Olga Kornievskaia [this message]
2008-06-25  0:50 ` [PATCH] NFSD: fix use of setsockopt Dean Hildebrand
2008-06-25 19:40   ` J. Bruce Fields
2008-06-25 19:37 ` J. Bruce Fields
2008-06-25 20:44   ` Olga Kornievskaia
2008-06-26 17:14     ` J. Bruce Fields
2008-06-26 17:59   ` Sm-notify Laurenz, Dirk
     [not found]     ` <FC3FA7C4E1CA2348B5579A68B24556E9DA4AF2946C-KofoAzQUpSBAuK1PVaBULA@public.gmane.org>
2008-06-27  2:22       ` Sm-notify NeilBrown
     [not found]         ` <46260.192.168.1.70.1214533375.squirrel-eq65iwfR9nKIECXXMXunQA@public.gmane.org>
2008-06-27  6:58           ` Sm-notify Oeltze, Benjamin
2008-06-27 23:44             ` Sm-notify Neil Brown
     [not found]               ` <18533.31573.855657.391140-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-06-28  7:38                 ` Sm-notify Laurenz, Dirk
2008-06-28 10:33                   ` Sm-notify Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=485A6033.3090301@citi.umich.edu \
    --to=aglo@citi.umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox