Bug 289306 - loader fails to parse vdisk device names
Summary: loader fails to parse vdisk device names
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Warner Losh
URL:
Keywords: loader
Depends on:
Blocks:
 
Reported: 2025-09-04 22:18 UTC by Jordan Gordeev
Modified: 2025-11-13 00:11 UTC (History)
4 users (show)

See Also:
linimon: mfc-stable14?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordan Gordeev 2025-09-04 22:18:11 UTC
The loader has a "map-vdisk" command. It creates virtual disk devices with names like "vdisk0:", "vdisk1:", "vdisk2:", etc.

After creating a vdisk0: device which is visible in the output of "lsdev", the command "set currdev=vdisk0:" fails with the error "bad unit number". This is unexpected and seems to be caused by an assumption in disk_parsedev() that the text before the unit number will be 4 characters in length:
	np = devspec + 4;	/* Skip the leading 'disk' */

Observed on FreeBSD 15.0-PRERELEASE, snapshot from 28 August 2025.
Comment 1 Warner Losh freebsd_committer freebsd_triage 2025-09-05 00:04:46 UTC
Yes, that's the assumption. and that needs to be fixed. This has been the case for years at this point (since before I rewrote the parse code a couple of years ago).

I wonder what other problems this will expose (eg, there's no way they've ever been used in FreeBSD since this was committed, if I'm reading a quick blame correctly, but I'm not 100% sure). But since I wrote that code (or touched it most lately), I'll take this.

It's likely easy to fix, but just fixing the parsing may not fix the feature.
Comment 2 Warner Losh freebsd_committer freebsd_triage 2025-09-12 15:46:57 UTC
https://reviews.freebsd.org/D52500
might fix this problem. I really don't know. It will get past the parsing issue.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-11-11 00:57:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d18ed8e19c3cb264340987bdc191615108d8413a

commit d18ed8e19c3cb264340987bdc191615108d8413a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-11-11 00:41:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-11-11 00:56:11 +0000

    stand: Try to parse vdisk correctly

    PR:                     289306
    Sponsored by:           Netflix
    Reviewed by:            dab
    MFC After:              5 days
    Differential Revision:  https://reviews.freebsd.org/D52500

 stand/common/disk.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)