• H
    rhashtable: Fix rhashtable_remove failures · 565e8640
    Herbert Xu 提交于
    The commit 9d901bc0 ("rhashtable:
    Free bucket tables asynchronously after rehash") causes gratuitous
    failures in rhashtable_remove.
    
    The reason is that it inadvertently introduced multiple rehashing
    from the perspective of readers.  IOW it is now possible to see
    more than two tables during a single RCU critical section.
    
    Fortunately the other reader rhashtable_lookup already deals with
    this correctly thanks to c4db8848
    ("rhashtable: rhashtable: Move future_tbl into struct bucket_table")
    so only rhashtable_remove is broken by this change.
    
    This patch fixes this by looping over every table from the first
    one to the last or until we find the element that we were trying
    to delete.
    
    Incidentally the simple test for detecting rehashing to prevent
    starting another shrinking no longer works.  Since it isn't needed
    anyway (the work queue and the mutex serves as a natural barrier
    to unnecessary rehashes) I've simply killed the test.
    Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    565e8640
rhashtable.c 25.3 KB