Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310719
b: refs/heads/master
c: 55432d2
h: refs/heads/master
i:
  310717: c07472e
  310715: 719256c
  310711: 087a5a9
  310703: ac084b1
  310687: 2267e6e
  310655: 7d3a195
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jun 6, 2012
1 parent efca419 commit 7d94017
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 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: dd03cff23d694cfb0fdae80cb618e7ced05ea696
refs/heads/master: 55432d2b543a4b6dfae54f5c432a566877a85d90
5 changes: 4 additions & 1 deletion trunk/include/net/inetpeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ struct inet_peer {
u32 pmtu_orig;
u32 pmtu_learned;
struct inetpeer_addr_base redirect_learned;
struct list_head gc_list;
union {
struct list_head gc_list;
struct rcu_head gc_rcu;
};
/*
* Once inet_peer is queued for deletion (refcnt == -1), following fields
* are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
Expand Down
16 changes: 12 additions & 4 deletions trunk/net/ipv4/inetpeer.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,17 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout)
}
EXPORT_SYMBOL(inet_peer_xrlim_allow);

static void inetpeer_inval_rcu(struct rcu_head *head)
{
struct inet_peer *p = container_of(head, struct inet_peer, gc_rcu);

spin_lock_bh(&gc_lock);
list_add_tail(&p->gc_list, &gc_list);
spin_unlock_bh(&gc_lock);

schedule_delayed_work(&gc_work, gc_delay);
}

void inetpeer_invalidate_tree(int family)
{
struct inet_peer *old, *new, *prev;
Expand All @@ -576,10 +587,7 @@ void inetpeer_invalidate_tree(int family)
prev = cmpxchg(&base->root, old, new);
if (prev == old) {
base->total = 0;
spin_lock(&gc_lock);
list_add_tail(&prev->gc_list, &gc_list);
spin_unlock(&gc_lock);
schedule_delayed_work(&gc_work, gc_delay);
call_rcu(&prev->gc_rcu, inetpeer_inval_rcu);
}

out:
Expand Down

0 comments on commit 7d94017

Please sign in to comment.