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
F82049468: D34567.diff
Thu, Apr 25, 12:22 AM
Unknown Object (File)
Sat, Mar 30, 8:32 PM
Unknown Object (File)
Mar 17 2024, 2:15 AM
Unknown Object (File)
Mar 14 2024, 11:41 AM
Unknown Object (File)
Mar 14 2024, 10:43 AM
Unknown Object (File)
Mar 14 2024, 9:06 AM
Unknown Object (File)
Mar 7 2024, 6:26 PM
Unknown Object (File)
Jan 14 2024, 8:21 AM

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