Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172130
b: refs/heads/master
c: b099ce2
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Dec 3, 2009
1 parent 0074e7b commit edd49cd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 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: 575f4cd5a5b639457747434dbe18d175fa767db4
refs/heads/master: b099ce2602d806deb41caaa578731848995cdb2a
6 changes: 3 additions & 3 deletions trunk/include/net/inet_timewait_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw,
extern void inet_twsk_deschedule(struct inet_timewait_sock *tw,
struct inet_timewait_death_row *twdr);

extern void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo,
extern void inet_twsk_purge(struct inet_hashinfo *hashinfo,
struct inet_timewait_death_row *twdr, int family);

static inline
struct net *twsk_net(const struct inet_timewait_sock *twsk)
{
#ifdef CONFIG_NET_NS
return twsk->tw_net;
return rcu_dereference(twsk->tw_net);
#else
return &init_net;
#endif
Expand All @@ -229,7 +229,7 @@ static inline
void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
{
#ifdef CONFIG_NET_NS
twsk->tw_net = net;
rcu_assign_pointer(twsk->tw_net, net);
#endif
}
#endif /* _INET_TIMEWAIT_SOCK_ */
10 changes: 5 additions & 5 deletions trunk/net/ipv4/inet_timewait_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void inet_twdr_twcal_tick(unsigned long data)

EXPORT_SYMBOL_GPL(inet_twdr_twcal_tick);

void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo,
void inet_twsk_purge(struct inet_hashinfo *hashinfo,
struct inet_timewait_death_row *twdr, int family)
{
struct inet_timewait_sock *tw;
Expand All @@ -436,15 +436,15 @@ void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo,
restart:
sk_nulls_for_each_rcu(sk, node, &head->twchain) {
tw = inet_twsk(sk);
if (!net_eq(twsk_net(tw), net) ||
tw->tw_family != family)
if ((tw->tw_family != family) ||
atomic_read(&twsk_net(tw)->count))
continue;

if (unlikely(!atomic_inc_not_zero(&tw->tw_refcnt)))
continue;

if (unlikely(!net_eq(twsk_net(tw), net) ||
tw->tw_family != family)) {
if (unlikely((tw->tw_family != family) ||
atomic_read(&twsk_net(tw)->count))) {
inet_twsk_put(tw);
goto restart;
}
Expand Down
11 changes: 8 additions & 3 deletions trunk/net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2529,12 +2529,17 @@ static int __net_init tcp_sk_init(struct net *net)
static void __net_exit tcp_sk_exit(struct net *net)
{
inet_ctl_sock_destroy(net->ipv4.tcp_sock);
inet_twsk_purge(net, &tcp_hashinfo, &tcp_death_row, AF_INET);
}

static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
{
inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET);
}

static struct pernet_operations __net_initdata tcp_sk_ops = {
.init = tcp_sk_init,
.exit = tcp_sk_exit,
.init = tcp_sk_init,
.exit = tcp_sk_exit,
.exit_batch = tcp_sk_exit_batch,
};

void __init tcp_v4_init(void)
Expand Down
11 changes: 8 additions & 3 deletions trunk/net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,12 +2184,17 @@ static int tcpv6_net_init(struct net *net)
static void tcpv6_net_exit(struct net *net)
{
inet_ctl_sock_destroy(net->ipv6.tcp_sk);
inet_twsk_purge(net, &tcp_hashinfo, &tcp_death_row, AF_INET6);
}

static void tcpv6_net_exit_batch(struct list_head *net_exit_list)
{
inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET6);
}

static struct pernet_operations tcpv6_net_ops = {
.init = tcpv6_net_init,
.exit = tcpv6_net_exit,
.init = tcpv6_net_init,
.exit = tcpv6_net_exit,
.exit_batch = tcpv6_net_exit_batch,
};

int __init tcpv6_init(void)
Expand Down

0 comments on commit edd49cd

Please sign in to comment.