Re: xfrm_state locking regression...
From: Timo Teräs <hidden>
Date: 2008-09-23 09:39:56
Herbert Xu wrote:
However, I think this is still open to the same problem that my patch had, i.e., if a dumper goes to sleep during the dump we may prevent entries from being freed indefinitely. Yes your idea is better in that we may only withhold say a fraction (depending on the order of deletion it could be anywhere from none to every entry) of the entries instead of all of them, but fundamentally the same issue is still there. Considering the fact that dumps require root privileges I'm not convinced as of yet that this is worth it. Hmm, could we perhaps go back to your original scheme of keeping everything on the list and see if we can use RCU to make it lockless instead?
How about this: we keep list of walks as your latest patch does. When walking is interrupted, we do not hold the entry, we just store the pointer to walk iterator. When the entry is deleted from the lists we go through the walk contexts, and if someone is pointing to the entry being deleted, we just update it to next. The list of walkers can be protected by xfrm_state_lock. That needs to be taken anyway for accessing/modifying the other lists. During most of the time, there is no walks active, so the penalty for _destroy() is minimal. This would make it possibly to reclaim the deleted entries right away. Does this sound better? Cheers, Timo