Page MenuHomeFreeBSD

Make g_attach() return ENXIO for orphaned providers.
ClosedPublic

Authored by trasz on Oct 4 2020, 3:17 PM.

Details

Summary

Make g_attach() return ENXIO for orphaned providers.

This patch is somewhat incomplete - it doesn't update all the GEOM
classes to properly handle g_attach() errors. I'd like some feedback
before I go and do that.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

trasz requested review of this revision.Oct 4 2020, 3:17 PM
trasz created this revision.

It worries me that this introduces additional failure point where some classes do not check for it. I would investigate whether the situation of attachment to withered provider is actually possible and/or may be handled otherwise. I agree that there should be a problem with orohan() not being called for consumers attached in that moment, just not sure from what side it should better be addressed without deeper look.

Well, the way it came to be is it fixed an actual bug found by NetApp. It's quite hard to reproduce, but given all the places where we happily drop the topology lock, I don't see why it wouldn't happen.

Also, note that I'll update this diff to fix all the calls to g_attach() in the tree, if the approach above makes sense.

Add missing error checking.

One class left to do is graid(4); I'm not sure how to handle
the errors there. Add 'if (cp->provider != NULL)' before g_detach()
perhaps?

I don't suppose you have a good test case that triggers the underling issue, do you?

This revision is now accepted and ready to land.Oct 12 2020, 6:00 PM
In D26658#596394, @imp wrote:

I don't suppose you have a good test case that triggers the underling issue, do you?

No, sadly I don't.