Commit f6c27cdd authored by Wensong Zhang's avatar Wensong Zhang Committed by David S. Miller

[IPVS] add a sysctl variable to expire quiescent template

The patch is from Horms <horms@vergenet.net>
Signed-off-by: default avatarHorms <horms@verge.net.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c09db0b2
......@@ -358,6 +358,7 @@ enum {
NET_IPV4_VS_EXPIRE_NODEST_CONN=23,
NET_IPV4_VS_SYNC_THRESHOLD=24,
NET_IPV4_VS_NAT_ICMP_SEND=25,
NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE=26,
NET_IPV4_VS_LAST
};
......@@ -879,6 +880,7 @@ extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
*/
extern int sysctl_ip_vs_cache_bypass;
extern int sysctl_ip_vs_expire_nodest_conn;
extern int sysctl_ip_vs_expire_quiescent_template;
extern int sysctl_ip_vs_sync_threshold[2];
extern int sysctl_ip_vs_nat_icmp_send;
extern struct ip_vs_stats ip_vs_stats;
......
......@@ -453,7 +453,9 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
* Checking the dest server status.
*/
if ((dest == NULL) ||
!(dest->flags & IP_VS_DEST_F_AVAILABLE)) {
!(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
(sysctl_ip_vs_expire_quiescent_template &&
(atomic_read(&dest->weight) == 0))) {
IP_VS_DBG(9, "check_template: dest not available for "
"protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d "
"-> d:%u.%u.%u.%u:%d\n",
......
......@@ -75,6 +75,7 @@ static int sysctl_ip_vs_amemthresh = 1024;
static int sysctl_ip_vs_am_droprate = 10;
int sysctl_ip_vs_cache_bypass = 0;
int sysctl_ip_vs_expire_nodest_conn = 0;
int sysctl_ip_vs_expire_quiescent_template = 0;
int sysctl_ip_vs_sync_threshold[2] = { 3, 50 };
int sysctl_ip_vs_nat_icmp_send = 0;
......@@ -1447,9 +1448,9 @@ static struct ctl_table vs_vars[] = {
{
.ctl_name = NET_IPV4_VS_TO_ES,
.procname = "timeout_established",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED],
.data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1457,7 +1458,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_synsent",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1465,7 +1466,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_synrecv",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1473,7 +1474,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_finwait",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1489,7 +1490,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_close",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1497,7 +1498,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_closewait",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1505,7 +1506,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_lastack",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1513,7 +1514,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_listen",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1521,7 +1522,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_synack",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1529,7 +1530,7 @@ static struct ctl_table vs_vars[] = {
.procname = "timeout_udp",
.data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP],
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
},
{
......@@ -1557,6 +1558,14 @@ static struct ctl_table vs_vars[] = {
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{
.ctl_name = NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE,
.procname = "expire_quiescent_template",
.data = &sysctl_ip_vs_expire_quiescent_template,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{
.ctl_name = NET_IPV4_VS_SYNC_THRESHOLD,
.procname = "sync_threshold",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment