]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
rhashtable: add lockdep tracking to bucket bit-spin-locks.
authorNeilBrown <neilb@suse.com>
Mon, 1 Apr 2019 23:07:45 +0000 (10:07 +1100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2019 02:12:12 +0000 (19:12 -0700)
commit149212f07856b25a9d342bfd6d736519b2ef66dc
treeb2fc4e6c9902041bcdb4c8bfc44d2d5d3040088c
parent8f0db018006a421956965e1149234c4e8db718ee
rhashtable: add lockdep tracking to bucket bit-spin-locks.

Native bit_spin_locks are not tracked by lockdep.

The bit_spin_locks used for rhashtable buckets are local
to the rhashtable implementation, so there is little opportunity
for the sort of misuse that lockdep might detect.
However locks are held while a hash function or compare
function is called, and if one of these took a lock,
a misbehaviour is possible.

As it is quite easy to add lockdep support this unlikely
possibility seems to be enough justification.

So create a lockdep class for bucket bit_spin_lock and attach
through a lockdep_map in each bucket_table.

Without the 'nested' annotation in rhashtable_rehash_one(), lockdep
correctly reports a possible problem as this lock is taken
while another bucket lock (in another table) is held.  This
confirms that the added support works.
With the correct nested annotation in place, lockdep reports
no problems.

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