Page MenuHomeFreeBSD

Use atomics for object reference count so that we can use the shared lock to protect it.

Authored by jeff on Sep 10 2019, 8:34 PM.



This allows for shared locks in some cases where we are manipulating the object reference count.

It would be possible for non-vnode objects to actually atomically drop the reference count with no lock held as long as it is above 2. Callers that expect stable reference counts with the write lock held only require it stay stable below 2. The relationship between the object and vnode reference counts make this much more complex for vnodes. I would like to refactor this so we only bump the vnode ref for the first object ref but it requires other changes to vfs.

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jeff added reviewers: alc, kib, markj, dougm.
This revision is now accepted and ready to land.Sep 22 2019, 1:42 PM
525 ↗(On Diff #61916)

BTW, why do you need the object lock there at all ? The object->type can only migrate from OBJT_VNODE to OBJT_DEAD until we hold the reference.