Details
-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
None
-
3
-
9223372036854775807
Description
when one thread leaving cfs hash iteration it checks whether it's time to rehash in cfs_hash_for_each_exit():
if (bits > 0) {
cfs_hash_rehash(hs, atomic_read(&hs->hs_count) <
CFS_HASH_LOOP_HOG);
then cfs_hash_rehash() can start rehashing immediately (not via worker thread):
if (!do_rehash) { /* launch and return */ queue_work(cfs_rehash_wq, &hs->hs_rehash_work); cfs_hash_unlock(hs, 1); return; } /* rehash right now */ cfs_hash_unlock(hs, 1); cfs_hash_rehash_worker(&hs->hs_rehash_work);
if another thread is starting to iterate the same hash it can find it being rehashed and there is no way to wait for rehashing completion, that works for rehashing in a dedicated thread only:
if (cfs_hash_is_rehashing(hs))
cfs_hash_rehash_cancel(hs);
so 2nd thread just proceed and find hash under rehashing:
LASSERT(!cfs_hash_is_rehashing(hs));