Page MenuHomeFreeBSD

geom(4): Look for aliases when searching for providers by name
AcceptedPublic

Authored by cem on Jun 6 2020, 4:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 7 2024, 2:58 AM
Unknown Object (File)
Jan 10 2024, 10:03 PM
Unknown Object (File)
Jan 7 2024, 5:54 AM
Unknown Object (File)
Jan 7 2024, 5:54 AM
Unknown Object (File)
Jan 7 2024, 5:42 AM
Unknown Object (File)
Dec 20 2023, 4:14 AM
Unknown Object (File)
Oct 26 2023, 1:34 PM
Unknown Object (File)
Aug 31 2023, 7:42 AM
Subscribers

Details

Test Plan
# geli attach /dev/gpt/testingeli
Enter passphrase:
GEOM_ELI: Device md0s1.eli created.
GEOM_ELI: Encryption: AES-XTS 128
GEOM_ELI:     Crypto: software
GEOM_LABEL[2]: Tasting md0s1.eli.

# ls -l /dev/gpt/testingeli*
lrwxr-xr-x 1 root wheel  8 Jun  6 09:22 /dev/gpt/testingeli -> ../md0s1
lrwxr-xr-x 1 root wheel 12 Jun  6 09:24 /dev/gpt/testingeli.eli -> ../md0s1.eli

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31539
Build 29142: arc lint + arc unit

Event Timeline

cem requested review of this revision.Jun 6 2020, 4:27 PM
cem created this revision.

I took this approach because many geom_*_ctl consumers use this API to locate /dev/foo names. Another option would be to do realpath in userspace, but this seems more robust to me, and in the spirit of having provider aliases.

Does this approach make sense to you? Thanks.

sys/geom/geom_subr.c
783–786

The 'continue' case should skip this provider IFF the provider name does not match arg AND no alias of the provider matches arg.

This revision is now accepted and ready to land.Jun 6 2020, 9:14 PM

Were you able to find out why GPT partitions are not showing up in the /dev/diskid directory (e.g. /dev/diskid/DISK-BHYVE-2613-8EFD-BAF4p2), or are you not seeing similar behavior (since it might be specific to my usage, details in Message-ID: <cb21f4a0-f9d4-db5d-287a-0cb29c023b75@delphij.net>)?

Were you able to find out why GPT partitions are not showing up in the /dev/diskid directory (e.g. /dev/diskid/DISK-BHYVE-2613-8EFD-BAF4p2), or are you not seeing similar behavior (since it might be specific to my usage, details in Message-ID: <cb21f4a0-f9d4-db5d-287a-0cb29c023b75@delphij.net>)?

I was able to reproduce the problem in a VM, but did not discover why partition aliases were not being created on /dev/diskid entries.

It seems that the lack of /dev/diskid nodes was not a regression so it's not a blocker.

However this patch is incomplete as some GEOM classes are not using g_provider_by_name (see the variant of this revision in https://github.com/delphij/freebsd/commits/scratch/geom ). I think a better way of doing this would be to refactor the lookup routines out.

On an unrelated note -- @mav I noticed that you have added the prefer non-withered providers logic in rS280685 but it's not obvious to me why we want to return an withered provider in g_provider_by_name(). Do you still remember the scenario that this would be useful for the caller?

On an unrelated note -- @mav I noticed that you have added the prefer non-withered providers logic in rS280685 but it's not obvious to me why we want to return an withered provider in g_provider_by_name(). Do you still remember the scenario that this would be useful for the caller?

I don't remember what cause I had for it in g_provider_by_name(), may be just wanted to be safe, but I do see it convenient and right to be able to see withered providers and geoms in the command line tools. They may stay like this for a long time if consumer haven't closed them, and the tools help with debugging.

I haven't looked much on aliases, but this looks good to me.