diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2004-09-02 19:01:02 -0700 |
|---|---|---|
| committer | Patrick McHardy <kaber@trash.net> | 2004-09-02 19:01:02 -0700 |
| commit | 10bc956350e6821a1a9757065962f1924649b12d (patch) | |
| tree | d0f669db8ba2bb401cb7d5a2c8f286d7cb02ca56 /net/ipv4/tcp_timer.c | |
| parent | 954bebf6b0d387241bf9a15a68791c13f1af32e3 (diff) | |
[NET]: Add reference counting to neigh_parms.
I've added a refcnt on neigh_parms as well as a dead flag. The latter
is checked under the tbl_lock before adding a neigh entry to the hash
table.
The non-trivial bit of the patch is the first chunk of net/core/neighbour.c.
I removed that line because not doing so would mean that I have to drop
the reference to the parms right there. That would've lead to race
conditions since many places dereference neigh->parms without holding
locks. It's also unnecessary to reset n->parms since we're no longer
in a hurry to see it go due to the new ref counting.
You'll also notice that I've put all dereferences of dev->*_ptr under
the rcu_read_lock(). Without this we may get a neigh_parms that's
already been released.
Incidentally a lot of these places were racy even before the RCU change.
For example, in the IPv6 case neigh->parms may be set to a value that's
just been released.
Finally in order to make sure that all stale entries are purged as
quickly as possible I've added neigh_ifdown/arp_ifdown calls after
every neigh_parms_release call. In many cases we now have multiple
calls to neigh_ifdown in the shutdown path. I didn't remove the
earlier calls because there may be hidden dependencies for them to
be there. Once the respective maintainers have looked at them we
can probably remove most of them.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
0 files changed, 0 insertions, 0 deletions
