This is based on the discussion around the (now reverted) r334708.
Some internal routines inspect v_iflags after a lockless refcount bump.
In general the locking protocol requires the interlock for this, and
without it memory reordering introduces races that can cause spurious
assertion failures. Add some INVARIANTS-only macros to address some
known races. I don't claim that this is an exhaustive fix, though.
Please feel free to suggest alternate names for the macros.
Details
Details
Ask Justin to test.
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Please add comments explaining that these fences are used to ensure visibility of the v_iflags vs v_holdcnt updates.
Comment Actions
I think the current names while justifiable only add confusion (why is refcount *acquire* paired with fence *rel*?). How about 'VNODE_REFCOUNT_FENCE_BEFORE' and after.
No strong opinions though.
Comment Actions
I'm not crazy about the names, but I do think it's reasonably clear that "acquire" refers to the fence and not a refcount operation. At least, the naming is consistent with atomic(9). _BEFORE and _AFTER is tied too closely to the existing uses IMHO. We might want to add uses where those suffixes don't make much sense.