Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73286
b: refs/heads/master
c: efac527
h: refs/heads/master
v: v3
  • Loading branch information
Rumen G. Bogdanovski authored and David S. Miller committed Nov 7, 2007
1 parent e5c1740 commit 29bb7e3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e356f9cdfa885c78791d5d6e5d2baef22f01853
refs/heads/master: efac52762b1e3fe3035d29e82d8ee1aebc45e4a7
4 changes: 4 additions & 0 deletions trunk/include/net/ip_vs.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ struct ip_vs_conn {
spinlock_t lock; /* lock for state transition */
volatile __u16 flags; /* status flags */
volatile __u16 state; /* state info */
volatile __u16 old_state; /* old state, to be used for
* state transition triggerd
* synchronization
*/

/* Control members */
struct ip_vs_conn *control; /* Master control connection */
Expand Down
20 changes: 14 additions & 6 deletions trunk/net/ipv4/ipvs/ip_vs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,15 +979,23 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb,
ret = NF_ACCEPT;
}

/* increase its packet counter and check if it is needed
to be synchronized */
/* Increase its packet counter and check if it is needed
* to be synchronized
*
* Sync connection if it is about to close to
* encorage the standby servers to update the connections timeout
*/
atomic_inc(&cp->in_pkts);
if ((ip_vs_sync_state & IP_VS_STATE_MASTER) &&
(cp->protocol != IPPROTO_TCP ||
cp->state == IP_VS_TCP_S_ESTABLISHED) &&
(atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1]
== sysctl_ip_vs_sync_threshold[0]))
(((cp->protocol != IPPROTO_TCP ||
cp->state == IP_VS_TCP_S_ESTABLISHED) &&
(atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1]
== sysctl_ip_vs_sync_threshold[0])) ||
((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) &&
((cp->state == IP_VS_TCP_S_FIN_WAIT) ||
(cp->state == IP_VS_TCP_S_CLOSE)))))
ip_vs_sync_conn(cp);
cp->old_state = cp->state;

ip_vs_conn_put(cp);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/ipvs/ip_vs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen)
if (!dest) {
/* it is an unbound entry created by
* synchronization */
cp->state = ntohs(s->state);
cp->flags = flags | IP_VS_CONN_F_HASHED;
} else
atomic_dec(&dest->refcnt);
Expand All @@ -358,6 +357,7 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen)
p += SIMPLE_CONN_SIZE;

atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]);
cp->state = ntohs(s->state);
pp = ip_vs_proto_get(s->protocol);
cp->timeout = pp->timeout_table[cp->state];
ip_vs_conn_put(cp);
Expand Down

0 comments on commit 29bb7e3

Please sign in to comment.