Page MenuHomeFreeBSD

Add new devd notifications for GEOM devices creation and destruction.
ClosedPublic

Authored by trasz on Nov 23 2014, 10:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 28 2024, 8:19 AM
Unknown Object (File)
Mar 10 2024, 5:41 AM
Unknown Object (File)
Feb 7 2024, 2:47 PM
Unknown Object (File)
Jan 19 2024, 6:13 PM
Unknown Object (File)
Dec 20 2023, 3:10 AM
Unknown Object (File)
Nov 2 2023, 10:02 PM
Unknown Object (File)
Oct 24 2023, 2:37 AM
Unknown Object (File)
Oct 12 2023, 12:44 AM

Details

Reviewers
mav
bcr
Group Reviewers
Doc Committers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

trasz retitled this revision from to Add new devd notifications for GEOM devices creation and destruction..
trasz updated this object.
trasz edited the test plan for this revision. (Show Details)

Aren't the existing events enough:
!system=DEVFS subsystem=CDEV type=CREATE cdev=md0
!system=DEVFS subsystem=CDEV type=MEDIACHANGE cdev=md0
!system=DEVFS subsystem=CDEV type=DESTROY cdev=md0

This way you get notifications for all devices, not just for "disk-like" ones.

I won't object too hard, but for me it still looks redundant. But if you go that way, MEDIACHANGE event should be either duplicated too or changed to a new style.

Hm, changing it would probably break someone's config, but duplicating could make sense. Especially given that it's not yet documented, so I'll just document the GEOM variant, not DEVFS, as it makes more sense this way.

One question, though: in which cases does it work? Card readers? Optical drives?

Any correctly implemented removable medium SCSI devices: optical drives, card readers, floppies, ...

Docs part looks good to me

stampofapproval

sys/geom/geom_dev.c
335

Not sure that is matters, I can't think of any devices with names nearly this long, but buf here (g_dev_taste) is buf[64], whereas above in g_dev_destroy, it is buf[63 + 6]

trasz edited edge metadata.

Updated diff - documentation improvements, MEDIACHANGE, and increased
buffer size.

In D1211#8, @allanjude wrote:

Docs part looks good to me

Agreed.

Forget about it for now. It can be easily done in a different way, simply running on any device creation and checking whether it's disk-like or not by calling diskinfo(1) and checking return status, and it's not an optimal solution (optimal would be to signal only devices with zero access counts, but that would cause infinite loop between devd callback and geom notification).

Reclaim. It cannot be done in a different way - diskinfo trick is ok, but only for device creation; won't help on destruction - and with this patch we also get notifications (mediachange, to be exact) after eg "newfs /dev/md0", which is exactly what we want.

not sure if this is in the tree or not, but this looks good to me.

bcr added a reviewer: bcr.
This revision is now accepted and ready to land.Jan 31 2015, 4:32 PM

So remind me why we can't use DEVfs again?

sbin/devd/devd.conf.5
44

Might want to use February 1, 2015 here.

381

Why can't you query the device from DEVFS and see if it is a geom or not?

sys/geom/geom_dev.c
180

You send this event before you destroy the device. You should send it after the device is gone.

188

Here.

215

Again, seems redundantly repetitive. Does DEVFS ever send a media change event on a non GEOM?

336

Assuming this is needed at all, this at least is in the right place.

Because I need notification about GEOM nodes - _all_ nodes, including partitions or whatever.eli, and _only_ GEOM nodes, ie nothing non-disk-like. I also need notification about those nodes disappearing - I could check whether something is disk-like device on node creation, but not after its destruction.