Page MenuHomeFreeBSD

Don't panic when tasting a disk with sectorsize=0
ClosedPublic

Authored by asomers on Nov 9 2022, 3:22 AM.

Details

Summary

This can sometimes happen with broken HDDs.

MFC after: 2 weeks
Sponsored by: Axcient

Test Plan

Manually tested with a suitably broken HDD

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Seems ok, but why not handle it in g_label_taste(), or even at some higher level in GEOM (maybe g_disk_create())? I can't think of any classes that will do something sane with a provider with sectorsize 0...

This revision is now accepted and ready to land.Nov 9 2022, 4:24 PM

Seems ok, but why not handle it in g_label_taste(), or even at some higher level in GEOM (maybe g_disk_create())? I can't think of any classes that will do something sane with a provider with sectorsize 0...

Ok, I'll move the part from g_label_ufs.c into g_label_taste. I don't want to move it higher up though, because g_label_taste can also be called in the resize path. And I'll leave the changes to the other label classes, because they're 0-cost.

  • Perform the check earlier
This revision now requires review to proceed.Nov 9 2022, 4:55 PM
markj added inline comments.
sys/geom/label/g_label_ufs.c
142

I'd convert the other label types to use KASSERT()s as well. Sure the runtime checks are zero-cost, but the inconsistency is confusing.

This revision is now accepted and ready to land.Nov 9 2022, 5:03 PM

Doh! I had hit 'looks good' too, but it didn't seem to register...