"unspoilable" geom labels

Andriy Gapon avg at FreeBSD.org
Tue Sep 12 14:21:52 UTC 2017


On 12/09/2017 16:28, Warner Losh wrote:
> The CAM code expects to be able to map the name 'da0' to 'pass14' so it can send
> the passthrough devices. It has no clue about device names, apart from passXXX
> it has to open to send the commands for the thing named 'da0'. In fact, it has
> no clue at all about the upper layers at all. I would argue that it would be
> quite difficult, given the current state of geom, to properly guess. It
> shouldn't even try. Bad things can only come from accidentally guessing wrong.

I mean that maybe it's not exactly the job of a function like cam_get_device(),
maybe it's a job if its callers (like camcontrol), but at the very least we
could check if /dev/$name is a symlink and resolve it.  I assume that the valid
device names always corresponding devices entries under /dev.

And, yes, mapping a GEOM label to an original name is harder than it should be
with the current implementation.  Maybe it would be easier with labels
implemented as aliases.

> Instead, if you really want this functionality, we should create either an ioctl
> to get this information (perhaps in a list for the case of gmirror, but perhaps
> not) or a bio attribute that could be synthesized properly. The third vehicle
> for this would be to put the attribute in the config for geom, but that's a bit
> of a pain.

I agree.  Maybe such a method would be a good thing to have regardless of the
labels implementation.

> Then again, you can't easily map an entry from /dev into a device_t that
> implements it (if any). You can't map a cam device, even, to a device_t either,
> just as far as the SIM if you look hard enough.

I think that this is a little bit different issue.  I think that getting from
e.g. /dev/diskid/DISK-MK0351YVKNNX3A to e.g. /dev/ada77 should be sufficient for
most userland utilities.

-- 
Andriy Gapon


More information about the freebsd-scsi mailing list