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)
Sat, Feb 1, 11:48 AM
Unknown Object (File)
Sat, Jan 18, 3:49 AM
Unknown Object (File)
Dec 16 2024, 4:02 PM
Unknown Object (File)
Nov 29 2024, 11:40 PM
Unknown Object (File)
Sep 25 2024, 8:40 AM
Unknown Object (File)
Sep 19 2024, 2:10 AM
Unknown Object (File)
Sep 18 2024, 6:47 PM
Unknown Object (File)
Sep 18 2024, 2:44 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.