Page MenuHomeFreeBSD

kern: osd: stop downsizing arrays when the last slot deregisters
ClosedPublic

Authored by kevans on Aug 10 2023, 8:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 2:16 AM
Unknown Object (File)
Thu, Apr 25, 6:10 PM
Unknown Object (File)
Mar 15 2024, 2:00 PM
Unknown Object (File)
Mar 15 2024, 2:00 PM
Unknown Object (File)
Mar 15 2024, 2:00 PM
Unknown Object (File)
Mar 11 2024, 5:24 PM
Unknown Object (File)
Dec 28 2023, 1:17 PM
Unknown Object (File)
Dec 20 2023, 5:32 AM
Subscribers

Details

Summary

It was noted in D41404 that these reallocations aren't actually
guaranteed to succeed, despite assertions to the contrary. We're
talking relatively small allocations, so just free up the individual
slot to be reused later as needed.

Note that this doesn't track the last active slot as of this moment, but
this could be done later if we find it's worth the complexity for what
little that would allow to be optimized (osd_call, slightly).

While we're here, fix the debug message that indicates which slot we
just allocated when we find an unused one; the slot # is actually one
higher than the index.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/kern_osd.c
178–179

Hmm. Should we also NULL out its entries in osd_methods so that we get a guaranteed fault on bogus use?

markj added inline comments.
sys/kern/kern_osd.c
178–179

I can't see any downsides to doing that.

This revision is now accepted and ready to land.Aug 11 2023, 3:31 PM
sys/kern/kern_osd.c
178–179

I think I'll punt on that until after the branch... what's here is relatively safe, and while NULLing out osd_methods *should be* I think I'll play it conservative and avoid adding code at all this close to branch time.