Page MenuHomeFreeBSD

fd: make serialization in fdescfree_fds conditional on hold count
ClosedPublic

Authored by mjg on Dec 9 2020, 2:44 PM.
Tags
None
Referenced Files
F132505986: D27522.id.diff
Fri, Oct 17, 11:57 AM
F132505985: D27522.id80531.diff
Fri, Oct 17, 11:57 AM
F132505983: D27522.id80477.diff
Fri, Oct 17, 11:57 AM
F132457881: D27522.diff
Fri, Oct 17, 2:38 AM
Unknown Object (File)
Tue, Oct 7, 4:16 AM
Unknown Object (File)
Tue, Sep 23, 5:41 PM
Unknown Object (File)
Sep 6 2025, 11:10 AM
Unknown Object (File)
Sep 2 2025, 3:23 AM
Subscribers

Details

Summary

p_fd nullification in fdescfree serializes against new threads transitioning the count 1 -> 2, meaning that fdescfree_fds observing the count of 1 can safely assume there is nobody else using the table. Losing the race and observing > 1 is harmless.

Diff Detail

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

Event Timeline

mjg requested review of this revision.Dec 9 2020, 2:44 PM
mjg created this revision.
markj added inline comments.
sys/kern/kern_descrip.c
2470 ↗(On Diff #80477)

It would be worth adding a sentence explaining why we know that fd_holdcnt can't increase at this point.

This revision is now accepted and ready to land.Dec 10 2020, 2:57 PM