aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:38:03 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-19 15:17:34 -0400
commit25fe6142a57c720452c5e9ddbc1f32309c1e5c19 (patch)
tree54ace9992e13ff9d3644bbb98ec8b74baf22b241
parent7d1e8255cf959fba7ee2317550dfde39f0b936ae (diff)
SUNRPC: Add a sysctl to control the duration of the socket linger timeout
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/xprtsock.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index b51f58b95c39..42222b4dd76d 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -50,6 +50,7 @@ unsigned int xprt_min_resvport = RPC_DEF_MIN_RESVPORT;
50unsigned int xprt_max_resvport = RPC_DEF_MAX_RESVPORT; 50unsigned int xprt_max_resvport = RPC_DEF_MAX_RESVPORT;
51 51
52#define XS_TCP_LINGER_TO (15U * HZ) 52#define XS_TCP_LINGER_TO (15U * HZ)
53static unsigned int xs_tcp_fin_timeout __read_mostly = XS_TCP_LINGER_TO;
53 54
54/* 55/*
55 * We can register our own files under /proc/sys/sunrpc by 56 * We can register our own files under /proc/sys/sunrpc by
@@ -119,6 +120,14 @@ static ctl_table xs_tunables_table[] = {
119 .extra2 = &xprt_max_resvport_limit 120 .extra2 = &xprt_max_resvport_limit
120 }, 121 },
121 { 122 {
123 .procname = "tcp_fin_timeout",
124 .data = &xs_tcp_fin_timeout,
125 .maxlen = sizeof(xs_tcp_fin_timeout),
126 .mode = 0644,
127 .proc_handler = &proc_dointvec_jiffies,
128 .strategy = sysctl_jiffies
129 },
130 {
122 .ctl_name = 0, 131 .ctl_name = 0,
123 }, 132 },
124}; 133};
@@ -1222,7 +1231,7 @@ static void xs_tcp_state_change(struct sock *sk)
1222 clear_bit(XPRT_CONNECTED, &xprt->state); 1231 clear_bit(XPRT_CONNECTED, &xprt->state);
1223 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 1232 clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
1224 smp_mb__after_clear_bit(); 1233 smp_mb__after_clear_bit();
1225 xs_tcp_schedule_linger_timeout(xprt, XS_TCP_LINGER_TO); 1234 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout);
1226 break; 1235 break;
1227 case TCP_CLOSE_WAIT: 1236 case TCP_CLOSE_WAIT:
1228 /* The server initiated a shutdown of the socket */ 1237 /* The server initiated a shutdown of the socket */
@@ -1239,7 +1248,7 @@ static void xs_tcp_state_change(struct sock *sk)
1239 break; 1248 break;
1240 case TCP_LAST_ACK: 1249 case TCP_LAST_ACK:
1241 set_bit(XPRT_CLOSING, &xprt->state); 1250 set_bit(XPRT_CLOSING, &xprt->state);
1242 xs_tcp_schedule_linger_timeout(xprt, XS_TCP_LINGER_TO); 1251 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout);
1243 smp_mb__before_clear_bit(); 1252 smp_mb__before_clear_bit();
1244 clear_bit(XPRT_CONNECTED, &xprt->state); 1253 clear_bit(XPRT_CONNECTED, &xprt->state);
1245 smp_mb__after_clear_bit(); 1254 smp_mb__after_clear_bit();