Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256257
b: refs/heads/master
c: 6d1a3e0
h: refs/heads/master
i:
  256255: 2ecb7d6
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jul 12, 2011
1 parent 69b03d2 commit 58b226e
Show file tree
Hide file tree
Showing 2 changed files with 10 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: 995181b9529adbfecd6882c734ee702b5ed9226c
refs/heads/master: 6d1a3e042f55861a785527a35a6f1ab4217ee810
14 changes: 9 additions & 5 deletions trunk/net/ipv4/inetpeer.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,14 @@ static int inet_peer_gc(struct inet_peer_base *base,
while (stackptr > stack) {
stackptr--;
p = rcu_deref_locked(**stackptr, base);
delta = (__u32)jiffies - p->dtime;
if (atomic_read(&p->refcnt) == 0 && delta >= ttl &&
atomic_cmpxchg(&p->refcnt, 0, -1) == 0) {
p->gc_next = gchead;
gchead = p;
if (atomic_read(&p->refcnt) == 0) {
smp_rmb();
delta = (__u32)jiffies - p->dtime;
if (delta >= ttl &&
atomic_cmpxchg(&p->refcnt, 0, -1) == 0) {
p->gc_next = gchead;
gchead = p;
}
}
}
while ((p = gchead) != NULL) {
Expand Down Expand Up @@ -456,6 +459,7 @@ EXPORT_SYMBOL_GPL(inet_getpeer);
void inet_putpeer(struct inet_peer *p)
{
p->dtime = (__u32)jiffies;
smp_mb__before_atomic_dec();
atomic_dec(&p->refcnt);
}
EXPORT_SYMBOL_GPL(inet_putpeer);
Expand Down

0 comments on commit 58b226e

Please sign in to comment.