]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
neigh: __rcu annotations
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 19 Jan 2011 22:02:47 +0000 (22:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Jan 2011 00:59:34 +0000 (16:59 -0800)
fix some minor issues and sparse (__rcu) warnings

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c

index 60a902913429c60ce56a77ba779fb70e65247414..799f06e03a220d4f611cef6f18551f4f58994450 100644 (file)
@@ -316,7 +316,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int entries)
 {
        size_t size = entries * sizeof(struct neighbour *);
        struct neigh_hash_table *ret;
-       struct neighbour **buckets;
+       struct neighbour __rcu **buckets;
 
        ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
        if (!ret)
@@ -324,14 +324,14 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int entries)
        if (size <= PAGE_SIZE)
                buckets = kzalloc(size, GFP_ATOMIC);
        else
-               buckets = (struct neighbour **)
+               buckets = (struct neighbour __rcu **)
                          __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
                                           get_order(size));
        if (!buckets) {
                kfree(ret);
                return NULL;
        }
-       rcu_assign_pointer(ret->hash_buckets, buckets);
+       ret->hash_buckets = buckets;
        ret->hash_mask = entries - 1;
        get_random_bytes(&ret->hash_rnd, sizeof(ret->hash_rnd));
        return ret;
@@ -343,7 +343,7 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
                                                    struct neigh_hash_table,
                                                    rcu);
        size_t size = (nht->hash_mask + 1) * sizeof(struct neighbour *);
-       struct neighbour **buckets = nht->hash_buckets;
+       struct neighbour __rcu **buckets = nht->hash_buckets;
 
        if (size <= PAGE_SIZE)
                kfree(buckets);
@@ -1540,7 +1540,7 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
                panic("cannot create neighbour proc dir entry");
 #endif
 
-       tbl->nht = neigh_hash_alloc(8);
+       RCU_INIT_POINTER(tbl->nht, neigh_hash_alloc(8));
 
        phsize = (PNEIGH_HASHMASK + 1) * sizeof(struct pneigh_entry *);
        tbl->phash_buckets = kzalloc(phsize, GFP_KERNEL);
@@ -1602,7 +1602,8 @@ int neigh_table_clear(struct neigh_table *tbl)
        }
        write_unlock(&neigh_tbl_lock);
 
-       call_rcu(&tbl->nht->rcu, neigh_hash_free_rcu);
+       call_rcu(&rcu_dereference_protected(tbl->nht, 1)->rcu,
+                neigh_hash_free_rcu);
        tbl->nht = NULL;
 
        kfree(tbl->phash_buckets);