Page MenuHomeFreeBSD

nfs: skip bootpc when vfs.root.mountfrom is other than nfs
ClosedPublic

Authored by alfredo on Apr 29 2022, 9:22 PM.
Referenced Files
F109367534: D35098.diff
Tue, Feb 4, 3:42 AM
Unknown Object (File)
Wed, Jan 22, 6:57 PM
Unknown Object (File)
Wed, Jan 22, 4:54 AM
Unknown Object (File)
Sun, Jan 12, 8:26 AM
Unknown Object (File)
Dec 24 2024, 2:44 PM
Unknown Object (File)
Dec 21 2024, 11:55 PM
Unknown Object (File)
Dec 16 2024, 7:54 PM
Unknown Object (File)
Dec 5 2024, 4:50 PM

Details

Summary

If "vfs.root.mountfrom" is set and the value is something other
than "nfs:*", it means the user doesn't want to mount root via nfs,
there's no reason to continue with bootpc

The powerpcspe kernel (MPC85XXSPE), compiled with BOOTP_NFSROOT
by default, gets stuck on bootpc/dhcp request loop when no DHCP
server is available on the network, even when user specifies a
local disk via "vfs.root.mountfrom" kernel parameter.

MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

Test Plan

test powerpcspe kernel under QEMU:

with "vfs.root.mountfrom" set to NFS
with "vfs.root.mountfrom" set to local partition (virtio-scsi)
without "vfs.root.mountfrom" and DHCP server on network
without "vfs.root.mountfrom" and without DHCP server on network

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45434
Build 42322: arc lint + arc unit

Event Timeline

alfredo added a reviewer: rmacklem.
alfredo added a project: PowerPC.
sjg added inline comments.
sys/nfs/bootp_subr.c
1537

Where might nfs: appear if not at the start of the string?

Beyond changing strstr() to a check for "nfs:" at the beginning of the
string, as suggested by sjg@, I don't see a problem with this.

However, I do not do diskless booting or know anything about
how vfs.root.mountroot is used, so I do not feel qualified to
review this. Maybe sjg@ could do so?

use strncmp instead of strstr in order to match only the beginning of the string

updated, thanks!

@rmacklem, 'vfs.root.mountroot' is used as a kernel parameter to specify (or override) where is the root filesystem to be mounted and its partition type. It's usually something like "vfs.root.mountroot=ufs:/dev/da0s1a" if you use a local disk, or "vfs.root.mountroot=nfs:192.168.0.1:/tftpboot/root" if using nfs.

It really needs someone familiar with bootstrapping to review this.
(Except for being the nfs case, it really has nothing to do with nfs.)

I think this is fine as is.
There's no need to check for nfs in the middle of a string, unless there's some use case I'm unaware of...

sys/nfs/bootp_subr.c
1537

I'm agnostic on strncmp vs strstr. What would be fore nfs:?

This revision is now accepted and ready to land.May 30 2022, 6:27 PM
alfredo added inline comments.
sys/nfs/bootp_subr.c
1537

yes, it's expected to have "nfs:" right in the beginning. thanks!