Page MenuHomeFreeBSD

vfs: handle vfs_init() failures
ClosedPublic

Authored by kevans on Aug 20 2025, 2:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 11, 2:59 PM
Unknown Object (File)
Sat, Oct 11, 2:59 PM
Unknown Object (File)
Sat, Oct 11, 2:59 PM
Unknown Object (File)
Sat, Oct 11, 2:59 PM
Unknown Object (File)
Sat, Oct 11, 6:34 AM
Unknown Object (File)
Thu, Oct 9, 4:52 PM
Unknown Object (File)
Thu, Oct 9, 6:03 AM
Unknown Object (File)
Fri, Oct 3, 6:38 PM
Subscribers

Details

Summary

Most vfs_init implementations will not fail, with the notable current
exception that tmpfs_subr_init() can fail to allocate a new swap pager
type, in which case we probably do not want to proceed and keep it
registered.

Another commit will also start to propagate a fatal error during
linsysfs init, which should likely also not keep the vfs registered.

Diff Detail

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

Event Timeline

Small typo in the comment.

sys/kern/vfs_init.c
523

s/ony/only/

sys/kern/vfs_init.c
523

I do not understand the motivation for this. IMO we should unwind always. Memorize the state of the vfsconf before loading, and reset ot.

Also, I think there should be something that prevents parallel registration/unwind/unregistration.

534
sys/kern/vfs_init.c
523

Both vfs_register and vfs_unregister takes the vfsconf_sx exclusively, and for the former it's held up to here. That seemed sufficient, is there some scenario where it isn't?

sys/kern/vfs_init.c
523

Sure, I jujst forget about them.

As an excuse, I can say that it was me who added vfsconf_lock (>10 years ago).

sys/kern/vfs_init.c
523

Ah, ok, perfect. =)

I'll fix your other concerns and update, since we might still want to do this for the off-chance that tmpfs fails to allocate a swap pager type (since linsysfs init will get pared down as you suggested).

kevans marked 4 inline comments as done.

Address review feedback: always unwind maxvfsconf change, compare != 0

This revision is now accepted and ready to land.Aug 22 2025, 11:19 AM

Kernel now boots on the Windows ARM Dev Kit. LGTM.

This revision was automatically updated to reflect the committed changes.