Ashton Fagg <ash...@fagg.id.au> wrote: > The committed diff fixes my original problem. However, I've now > encountered another one. On one of my machines (far slower than the > first one), the devices themselves are much slower to attach - this > leads to the same race condition as before, as "iscsictl reload" is only > aware that the connections have been initiated, not whether the drives > themselves are actually attached.
This is because the design of hotplug is completely broken. The driver does something, but not what people anticipate or understand. A hotplug event is delivered immediately after a device driver's attach function is called. Very few device drivers are intialize fully in one step. By very few, I really mean none. So you get an event, and you try to act upon it, but the driver still has to perform numerous timing sensitive operations to actually become ready. Thus, this incredible mismatch with what the subsystem, and the daemon promise: Events which do not indicate readiness. Unfortunately there is no instrumentation in drivers or subsystems to capture "ready to do work", and create the events at that point instead. hotplug is hooked into subr_autoconf.c, this code is for handling the device heirarchy, but it is not involved in operation, and thus unaware of "readiness". Fixing this would require a subsystem by subsystem study, figuring out where the glue should exist, and creating the events at the CORRECT time.