rhashtable: Add barrier to ensure we see new tables in walker
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 23 Mar 2015 13:50:19 +0000 (00:50 +1100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Mar 2015 02:07:51 +0000 (22:07 -0400)
The walker is a lockless reader so it too needs an smp_rmb before
reading the future_tbl field in order to see any new tables that
may contain elements that we should have walked over.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c

index 83cfedd6612aba4289613fcda973941a1ad1c7a6..618a3f00d71281e1021bf608508feaba3e0503c2 100644 (file)
@@ -477,6 +477,9 @@ next:
                iter->skip = 0;
        }
 
+       /* Ensure we see any new tables. */
+       smp_rmb();
+
        iter->walker->tbl = rht_dereference_rcu(tbl->future_tbl, ht);
        if (iter->walker->tbl) {
                iter->slot = 0;