Whamcloud - gitweb
b=18649 set wait_recovery_complete() MAX value to max recovery time estimated
[fs/lustre-release.git] / lustre / kernel_patches / patches / tcp-rto_proc-2.6.9.patch
1 Index: linux+rhel4+chaos/include/linux/sysctl.h
2 ===================================================================
3 --- linux+rhel4+chaos.orig/include/linux/sysctl.h
4 +++ linux+rhel4+chaos/include/linux/sysctl.h
5 @@ -348,6 +348,8 @@ enum
6         NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
7         NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=110,
8         NET_TCP_SLOW_START_AFTER_IDLE=111,
9 +       NET_TCP_RTO_MAX=112,
10 +       NET_TCP_RTO_INIT=113,
11  };
12  
13  enum {
14 Index: linux+rhel4+chaos/net/ipv4/sysctl_net_ipv4.c
15 ===================================================================
16 --- linux+rhel4+chaos.orig/net/ipv4/sysctl_net_ipv4.c
17 +++ linux+rhel4+chaos/net/ipv4/sysctl_net_ipv4.c
18 @@ -49,6 +49,10 @@ extern int inet_peer_maxttl;
19  extern int inet_peer_gc_mintime;
20  extern int inet_peer_gc_maxtime;
21  
22 +/* From tcp_timer.c */
23 +extern unsigned sysctl_tcp_rto_max;
24 +extern unsigned sysctl_tcp_rto_init;
25 +
26  #ifdef CONFIG_SYSCTL
27  static int tcp_retr1_max = 255; 
28  static int ip_local_port_range_min[] = { 1, 1 };
29 @@ -699,6 +703,22 @@ ctl_table ipv4_table[] = {
30                 .mode           = 0644,
31                 .proc_handler   = &proc_dointvec,
32         },
33 +       {
34 +               .ctl_name       = NET_TCP_RTO_MAX,
35 +               .procname       = "tcp_rto_max",
36 +               .data           = &sysctl_tcp_rto_max,
37 +               .maxlen         = sizeof(unsigned),
38 +               .mode           = 0644, 
39 +               .proc_handler   = &proc_dointvec
40 +       },
41 +       {
42 +               .ctl_name       = NET_TCP_RTO_INIT,
43 +               .procname       = "tcp_rto_init",
44 +               .data           = &sysctl_tcp_rto_init,
45 +               .maxlen         = sizeof(unsigned), 
46 +               .mode           = 0644,
47 +               .proc_handler   = &proc_dointvec
48 +       },
49         { .ctl_name = 0 }
50  };
51  
52 Index: linux+rhel4+chaos/net/ipv4/tcp_timer.c
53 ===================================================================
54 --- linux+rhel4+chaos.orig/net/ipv4/tcp_timer.c
55 +++ linux+rhel4+chaos/net/ipv4/tcp_timer.c
56 @@ -32,6 +32,9 @@ int sysctl_tcp_retries1 = TCP_RETR1;
57  int sysctl_tcp_retries2 = TCP_RETR2;
58  int sysctl_tcp_orphan_retries;
59  
60 +unsigned sysctl_tcp_rto_max        = TCP_RTO_MAX;
61 +unsigned sysctl_tcp_rto_init       = TCP_TIMEOUT_INIT;
62 +
63  static void tcp_write_timer(unsigned long);
64  static void tcp_delack_timer(unsigned long);
65  static void tcp_keepalive_timer (unsigned long data);
66 @@ -104,7 +107,7 @@ static int tcp_out_of_resources(struct s
67  
68         /* If peer does not open window for long time, or did not transmit 
69          * anything for long time, penalize it. */
70 -       if ((s32)(tcp_time_stamp - tp->lsndtime) > 2*TCP_RTO_MAX || !do_reset)
71 +       if ((s32)(tcp_time_stamp - tp->lsndtime) > 2*sysctl_tcp_rto_max || !do_reset)
72                 orphans <<= 1;
73  
74         /* If some dubious ICMP arrived, penalize even more. */
75 @@ -186,7 +189,7 @@ static int tcp_write_timeout(struct sock
76  
77                 retry_until = sysctl_tcp_retries2;
78                 if (sock_flag(sk, SOCK_DEAD)) {
79 -                       int alive = (tp->rto < TCP_RTO_MAX);
80 +                       int alive = (tp->rto < sysctl_tcp_rto_max);
81   
82                         retry_until = tcp_orphan_retries(sk, alive);
83  
84 @@ -292,7 +295,7 @@ static void tcp_probe_timer(struct sock 
85         max_probes = sysctl_tcp_retries2;
86  
87         if (sock_flag(sk, SOCK_DEAD)) {
88 -               int alive = ((tp->rto<<tp->backoff) < TCP_RTO_MAX);
89 +               int alive = ((tp->rto<<tp->backoff) < sysctl_tcp_rto_max);
90   
91                 max_probes = tcp_orphan_retries(sk, alive);
92  
93 @@ -336,7 +339,7 @@ static void tcp_retransmit_timer(struct 
94                                inet->num, tp->snd_una, tp->snd_nxt);
95                 }
96  #endif
97 -               if (tcp_time_stamp - tp->rcv_tstamp > TCP_RTO_MAX) {
98 +               if (tcp_time_stamp - tp->rcv_tstamp > sysctl_tcp_rto_max) {
99                         tcp_write_err(sk);
100                         goto out;
101                 }
102 @@ -405,7 +408,7 @@ static void tcp_retransmit_timer(struct 
103         tp->retransmits++;
104  
105  out_reset_timer:
106 -       tp->rto = min(tp->rto << 1, TCP_RTO_MAX);
107 +       tp->rto = min(tp->rto << 1, sysctl_tcp_rto_max);
108         tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto);
109         if (tp->retransmits > sysctl_tcp_retries1)
110                 __sk_dst_reset(sk);
111 @@ -502,7 +505,7 @@ static void tcp_synack_timer(struct sock
112         if (tp->defer_accept)
113                 max_retries = tp->defer_accept;
114  
115 -       budget = 2*(TCP_SYNQ_HSIZE/(TCP_TIMEOUT_INIT/TCP_SYNQ_INTERVAL));
116 +       budget = 2*(TCP_SYNQ_HSIZE/(sysctl_tcp_rto_init/TCP_SYNQ_INTERVAL));
117         i = lopt->clock_hand;
118  
119         do {
120 @@ -516,8 +519,8 @@ static void tcp_synack_timer(struct sock
121  
122                                         if (req->retrans++ == 0)
123                                                 lopt->qlen_young--;
124 -                                       timeo = min((TCP_TIMEOUT_INIT << req->retrans),
125 -                                                   TCP_RTO_MAX);
126 +                                       timeo = min((sysctl_tcp_rto_init << req->retrans),
127 +                                                   sysctl_tcp_rto_max);
128                                         req->expires = now + timeo;
129                                         reqp = &req->dl_next;
130                                         continue;