Fix panic when using BOOTP to resolve root path.

When loading a direct-boot kernel, a temporary route is being installed,
the NFS handle is acquired, and the temporary route is removed again.

This was being done inside a net epoch, but since the krpc code is written
using blocking APIs, we can't actually do that, because sleeping is not
allowed during a net epoch.

Exit and reenter the epoch so we are only in the epoch when doing the
routing table manipulation.

Fixes panic when booting my RB800 over NFS (where the kernel is loaded
using RouterBOOT directly.)

Reviewed by:	melifaro
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D29464
This commit is contained in:
Brandon Bergren 2021-03-27 19:18:51 -05:00
parent b218441ac0
commit 98727c6cd1

View File

@ -1682,9 +1682,11 @@ bootpc_init(void)
NET_EPOCH_ENTER(et);
bootpc_add_default_route(ifctx);
NET_EPOCH_EXIT(et);
error = md_mount(&nd->root_saddr, nd->root_hostnam,
nd->root_fh, &nd->root_fhsize,
&nd->root_args, td);
NET_EPOCH_ENTER(et);
bootpc_remove_default_route(ifctx);
NET_EPOCH_EXIT(et);
if (error != 0) {