Page MenuHomeFreeBSD

nfs: do not panic on bootpc_init when no interfaces are found
ClosedPublic

Authored by alfredo on Mar 15 2022, 1:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 16 2024, 3:01 PM
Unknown Object (File)
Oct 4 2024, 11:28 PM
Unknown Object (File)
Oct 4 2024, 7:16 PM
Unknown Object (File)
Oct 2 2024, 9:12 AM
Unknown Object (File)
Oct 2 2024, 7:20 AM
Unknown Object (File)
Oct 1 2024, 10:10 PM
Unknown Object (File)
Sep 30 2024, 2:30 AM
Unknown Object (File)
Sep 27 2024, 1:14 PM

Details

Summary

Replaces panic with a warning message to allow kernel continue
when no bootp eligible interfaces are found.

This avoids having to build a custom kernel when using a local root
file system on targets like powerpcspe that expects bootp/NFS by
default.

Test Plan

boot test powerpcspe on QEMU

Diff Detail

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

Event Timeline

During tests I found that when a eligible NIC exists and network isn't prepared for bootp, it cannot load the local root file system.
More investigation is required:

..
..
Sending DHCP Discover packet from interface vtnet0 (52:54:00:12:34:56)
vtnet0: link state changed to UP
Received DHCP Offer packet on vtnet0 from 10.0.2.2 (accepted)
Sending DHCP Request packet from interface vtnet0 (52:54:00:12:34:56)
Received DHCP Ack packet on vtnet0 from 10.0.2.2 (accepted)
vtnet0 at 10.0.2.15 server 10.0.2.2
subnet mask 255.255.255.0 router 10.0.2.2 
Adjusted interface vtnet0
WARNING: WITNESS option enabled, expect reduced performance.
Trying to mount root from ufs:/dev/vtbd0s3 []...
mountroot: waiting for device /dev/vtbd0s3...
Mounting from ufs:/dev/vtbd0s3 failed with error 19.

During tests I found that when a eligible NIC exists and network isn't prepared for bootp, it cannot load the local root file system.
More investigation is required:

Please discard this comment, this was due a mistake during tests. Anyway virtio-net and e1000 are not working due to problems not related to this patch and will be investigated in parallel. So please continue with review :)

I don't see a problem with doing this, but since I am
not familiar with the various situations used by bootp
for mounting a root fs, I can't say if this change will
cause problems.

Have you tested the case where there is no suitable
net interface and no local root fs to see if the failure
is "as clear" to users as the panic is?

Have you tested the case where there is no suitable
net interface and no local root fs to see if the failure
is "as clear" to users as the panic is?

@rmacklem, yes I tested it and for me it's still clear to users, the warning is visible before mountroot stuff. Here's how it looks like:

...
...
Event timer "decrementer" frequency 400000000 Hz quality 1000
Timecounters tick every 1.000 msec
usb_needs_explore_all: no devclass
WARNING: BOOTP found no eligible network interfaces, skipping!
WARNING: WITNESS option enabled, expect reduced performance.

Loader variables:

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        zfs:zroot/ROOT/default
        cd9660:/dev/cd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /)

  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input

mountroot>

Looks ok to me, although I'll admit I never
use diskless NFS root file systems nor bootp.

This revision is now accepted and ready to land.Apr 1 2022, 9:20 PM