# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1347 -> 1.1348 # net/ipv4/ipvs/ip_vs_ctl.c 1.10 -> 1.11 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/10/13 wensong@xxxxxxxxxxxx 1.1348 # [IPVS] Fix to set the statistics of dest zero when bound to a new service # -------------------------------------------- # diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c --- a/net/ipv4/ipvs/ip_vs_ctl.c Mon Oct 13 23:53:53 2003 +++ b/net/ipv4/ipvs/ip_vs_ctl.c Mon Oct 13 23:53:53 2003 @@ -650,6 +650,15 @@ } +static void +ip_vs_zero_stats(struct ip_vs_stats *stats) +{ + spin_lock_bh(&stats->lock); + memset(stats, 0, (char *)&stats->lock - (char *)stats); + spin_unlock_bh(&stats->lock); + ip_vs_zero_estimator(stats); +} + /* * Update a destination in the given service */ @@ -689,6 +698,7 @@ } else { if (dest->svc != svc) { __ip_vs_unbind_svc(dest); + ip_vs_zero_stats(&dest->stats); __ip_vs_bind_svc(dest, svc); } } @@ -1276,7 +1286,7 @@ * Flush the service table hashed by fwmark */ for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { - list_for_each_entry_safe(svc, nxt, + list_for_each_entry_safe(svc, nxt, &ip_vs_svc_fwm_table[idx], f_list) { write_lock_bh(&__ip_vs_svc_lock); ip_vs_svc_unhash(svc); @@ -1296,15 +1306,6 @@ /* * Zero counters in a service or all services */ -static void -ip_vs_zero_stats(struct ip_vs_stats *stats) -{ - spin_lock_bh(&stats->lock); - memset(stats, 0, (char *)&stats->lock - (char *)stats); - spin_unlock_bh(&stats->lock); - ip_vs_zero_estimator(stats); -} - static int ip_vs_zero_service(struct ip_vs_service *svc) { struct ip_vs_dest *dest; @@ -1550,10 +1551,10 @@ ++*pos; if (v == SEQ_START_TOKEN) return ip_vs_info_array(seq,0); - + svc = v; iter = seq->private; - + if (iter->table == ip_vs_svc_table) { /* next service in table hashed by protocol */ if ((e = svc->s_list.next) != &ip_vs_svc_table[iter->bucket]) @@ -1579,7 +1580,7 @@ scan_fwmark: while (++iter->bucket < IP_VS_SVC_TAB_SIZE) { list_for_each_entry(svc, &ip_vs_svc_fwm_table[iter->bucket], - f_list) + f_list) return svc; } @@ -1607,7 +1608,7 @@ const struct ip_vs_iter *iter = seq->private; const struct ip_vs_dest *dest; - if (iter->table == ip_vs_svc_table) + if (iter->table == ip_vs_svc_table) seq_printf(seq, "%s %08X:%04X %s ", ip_vs_proto_name(svc->protocol), ntohl(svc->addr), @@ -1625,7 +1626,7 @@ seq_putc(seq, '\n'); list_for_each_entry(dest, &svc->destinations, n_list) { - seq_printf(seq, + seq_printf(seq, " -> %08X:%04X %-7s %-6d %-10d %-10d\n", ntohl(dest->addr), ntohs(dest->port), ip_vs_fwd_name(atomic_read(&dest->conn_flags)), @@ -1686,7 +1687,7 @@ /* 01234567 01234567 01234567 0123456701234567 0123456701234567 */ seq_puts(seq, " Total Incoming Outgoing Incoming Outgoing\n"); - seq_printf(seq, + seq_printf(seq, " Conns Packets Packets Bytes Bytes\n"); spin_lock_bh(&ip_vs_stats.lock);