If multiple threads race calling vfs_hash_insert() while creating vnodes
with the same identity, all of the vnodes which lose the race must be
destroyed before any other thread can see them. Previously this was
accomplished by the vput() in vfs_hash_insert() resulting in the vnode's
VOP_INACTIVE() method calling vgone() before the vnode lock was unlocked,
but recent changes to the the vnode refcount/inactive logic cause that
to not work anymore, so instead vfs_hash_insert() must call vgone() itself
before calling vput() on vnodes which lose the race.
Details
Details
- Reviewers
kib mjg - Commits
- rS365351: vfs: avoid exposing partially constructed vnodes
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I strongly suspect this broke few years back.
I have a WIP patch to address this in a systematic manner. In the meantime this definitely should go in.
sys/kern/vfs_hash.c | ||
---|---|---|
171 ↗ | (On Diff #76522) | Somewhat unrelated: this break look strange, it terminates internal loop but while(1) just continues. I think we should return there instead. |