LU-14161 obdclass: fix some problems with obd_nid_hash
There are a few of problems with the handling of the obd_nid_hash
rhl-table.
- obd_export_evict_by_nid() drops out of rcu_readlock() while holding
a reference into the table. This is theoretically unsafe as changed
to the table might cause entries to be missed.
- nid_keycmp() ignores entries with exp_failed set. This is a problem
because rhltable_lookup() only compares the key for the *first*
object in a list of objects with the same key - on a match it
returns the whole list.
So if exp_failed was set on the first in the list, all would become
invisible.
These can be fixed by moving the test on ->exp_failed to after the
call to rhltabke_lookup(), and by using obd_nid_export_for_each() in
obd_export_evict_by_nid(), and repeatedly dealing with the first exp
returned.
Fixes:
580ef453d1d6 ("LU-8130 obd: convert obd_nid_hash to rhashtable")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I65861c179e93c26cf39c5db8a58e3e4c9b962fe3
Reviewed-on: https://review.whamcloud.com/40846
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>