]> git.baikalelectronics.ru Git - kernel.git/commit
rhashtable: move dereference inside rht_ptr()
authorNeilBrown <neilb@suse.com>
Fri, 12 Apr 2019 01:52:08 +0000 (11:52 +1000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Apr 2019 00:34:45 +0000 (17:34 -0700)
commit1c0fc60dfec33ef37fb797fa57af21d1ad6b0a56
tree6aae93c08ed6295e47300fbe11dc010ee1b32a1d
parent1655228c2b8cef2c55df20987e22bf95d270d771
rhashtable: move dereference inside rht_ptr()

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: NeilBrown <neilb@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rhashtable.h
lib/rhashtable.c
lib/test_rhashtable.c