ehlo,
The big problem with mmap_cache was solved
https://lists.fedorahosted.org/pipermail/sssd-devel/2013-August/016131.html
MAIN_PROBLEM: We know that main problem is when hash table entry
refers
to record, which hashes are different.
(hash_key != rec->hash1 && hash_key != rec->hash2)
I found a reason of another crash reported by user
https://bugzilla.redhat.com/show_bug.cgi?id=997406#c12
Problem is broken chain and it is not related to previous bugfix.
I will try to describe example.
hash_keys will be decimal numbers and slots will be indexed with hexadecimal
numbers.
Add record R1(hash_1:1, hash_2:2) stored at slot index 0x12
Add record R2(hash_1:3, hash_2:1) stored at slot index 0x31
Add record R3(hash_1:4, hash_2:3) stored at slot index 0x43
Add record R4(hash_1:5, hash_2:4) stored at slot index 0x54
Remove record R2
Remove record R3
You can see that each record is stored ad index:
concat("0x","hash_1","hash_2")
So you can easily know, which hashes record has.
Step 1)Add record R1(hash_1:1, hash_2:2) stored at slot index 0x12
hash[1] -> 0x12(R1) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> MC_INVALID_VAL
hash[3] -> MC_INVALID_VAL
hash[4] -> MC_INVALID_VAL
hash[5] -> MC_INVALID_VAL
Step 2)Add record R2(hash_1:3, hash_2:1) stored at slot index 0x31
hash[1] -> 0x12(R1) -> 0x31(R2) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x31(R2) -> MC_INVALID_VAL
hash[3] -> 0x31(R2) -> MC_INVALID_VAL
hash[4] -> MC_INVALID_VAL
hash[5] -> MC_INVALID_VAL
Step 3)Add record R3(hash_1:4, hash_2:3) stored at slot index 0x43
hash[1] -> 0x12(R1) -> 0x31(R2) -> 0x43(R3) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x31(R2) -> 0x43(R3) -> MC_INVALID_VAL
hash[3] -> 0x31(R2) -> 0x43(R3) -> MC_INVALID_VAL
hash[4] -> 0x43(R3) -> MC_INVALID_VAL
hash[5] -> MC_INVALID_VAL
Step 4)Add record R4(hash_1:5, hash_2:4) stored at slot index 0x54
hash[1] -> 0x12(R1) -> 0x31(R2) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x31(R2) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[3] -> 0x31(R2) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[4] -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[5] -> 0x54(R4) -> MC_INVALID_VAL
Step 5) Remove record R2(hash_1:3, hash_2:1) stored at slot index 0x31
a) Remove record R2 from chain starting by hash R2->hash1 (value 3)
hash[1] -> 0x12(R1) -> 0x31(R2) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x31(R2) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[3] -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[4] -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[5] -> 0x54(R4) -> MC_INVALID_VAL
b) Remove record R2 from chain starting by hash R2->hash2 (value 1)
hash[1] -> 0x12(R1) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[3] -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[4] -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[5] -> 0x54(R4) -> MC_INVALID_VAL
c) slots for record R2 are ivalidated.
Everything is OK.
Step 6) Remove record R3(hash_1:4, hash_2:3) stored at slot index 0x43
a) Remove record R3 from chain starting by hash R3->hash1 (value 4)
hash[1] -> 0x12(R1) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[3] -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[4] -> 0x54(R4) -> MC_INVALID_VAL
hash[5] -> 0x54(R4) -> MC_INVALID_VAL
b) Remove record R3 from chain starting by hash R3->hash2 (value 3)
hash[1] -> 0x12(R1) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> 0x43(R3) -> 0x54(R4) -> MC_INVALID_VAL
hash[3] -> MC_INVALID_VAL
hash[4] -> 0x54(R4) -> MC_INVALID_VAL
hash[5] -> 0x54(R4) -> MC_INVALID_VAL
c) slots for record R2 are ivalidated.
A you can see, record R3 is still in chain starting by hash with values 1,
but record R3 is invalidated and chain is broken.
Result:
hash[1] -> 0x12(R1) -> INVALIDATED_SLOT ??-> 0x54(R4) -> MC_INVALID_VAL
hash[2] -> 0x12(R1) -> INVALIDATED_SLOT ??-> 0x54(R4) -> MC_INVALID_VAL
hash[3] -> MC_INVALID_VAL
hash[4] -> 0x54(R4) -> MC_INVALID_VAL
hash[5] -> 0x54(R4) -> MC_INVALID_VAL
And my question is: How do we want to solve this problem?
I cannot find elegant simple solution.
We do not have any reference po previous member of chain.
a) We can remove record from each chain. It means that after removing record
from mmap_cache we will need to iterate over hashtable and to remove this
record from each chain.
b) We need to modify structure(s) of mmap cache.
-- either add two next references to record
-- or add reference to previous member of chain (double link list)
LS