Page MenuHomeFreeBSD

vfs: avoid exposing partially constructed vnodes
ClosedPublic

Authored by chs on Sep 1 2020, 11:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 22 2024, 3:10 AM
Unknown Object (File)
Oct 8 2024, 5:39 PM
Unknown Object (File)
Oct 5 2024, 5:57 PM
Unknown Object (File)
Oct 2 2024, 5:26 PM
Unknown Object (File)
Oct 2 2024, 4:49 AM
Unknown Object (File)
Oct 2 2024, 1:32 AM
Unknown Object (File)
Sep 30 2024, 6:26 PM
Unknown Object (File)
Sep 26 2024, 3:55 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

chs requested review of this revision.Sep 1 2020, 11:11 PM

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.

This revision is now accepted and ready to land.Sep 1 2020, 11:16 PM
kib added inline comments.
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.

This revision was automatically updated to reflect the committed changes.