rhashtable: reset iter when rhashtable_walk_start sees new table
authorNeilBrown <neilb@suse.com>
Mon, 23 Apr 2018 22:29:13 +0000 (08:29 +1000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Apr 2018 17:21:45 +0000 (13:21 -0400)
The documentation claims that when rhashtable_walk_start_check()
detects a resize event, it will rewind back to the beginning
of the table.  This is not true.  We need to set ->slot and
->skip to be zero for it to be true.

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c

index 6d490f51174e2b42d6612027bad84fec02f9d998..81edf1ab38ab8aa1fabc3df799bf2ac8b2234e8f 100644 (file)
@@ -737,6 +737,8 @@ int rhashtable_walk_start_check(struct rhashtable_iter *iter)
 
        if (!iter->walker.tbl && !iter->end_of_table) {
                iter->walker.tbl = rht_dereference_rcu(ht->tbl, ht);
+               iter->slot = 0;
+               iter->skip = 0;
                return -EAGAIN;
        }