• NeilBrown's avatar
    rhashtable: move dereference inside rht_ptr() · adc6a3ab
    NeilBrown authored
    Rather than dereferencing a pointer to a bucket and then passing the
    result to rht_ptr(), we now pass in the pointer and do the dereference
    in rht_ptr().
    
    This requires that we pass in the tbl and hash as well to support RCU
    checks, and means that the various rht_for_each functions can expect a
    pointer that can be dereferenced without further care.
    
    There are two places where we dereference a bucket pointer
    where there is no testable protection - in each case we know
    that we much have exclusive access without having taken a lock.
    The previous code used rht_dereference() to pretend that holding
    the mutex provided protects, but holding the mutex never provides
    protection for accessing buckets.
    
    So instead introduce rht_ptr_exclusive() that can be used when
    there is known to be exclusive access without holding any locks.
    Signed-off-by: default avatarNeilBrown <neilb@suse.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    adc6a3ab
rhashtable.c 29.6 KB