Re: RFC: Devices, buses and hotplug

David Hinds (dhinds@zen.stanford.edu)
Sun, 6 Jun 1999 12:43:31 -0700


On Sun, Jun 06, 1999 at 07:00:52PM +0100, Alan Cox wrote:
>
> > (4) The bus-dependent code receives an unplug notification and sends
> > it to the driver. The driver releases the device, bus-dependent
> > code removes it and deallocates all of its resources. Done.
>
> What if the driver says "Im in the middle of something" or "but there
> is an fs mounted".
>
> Just to remind you its -not- trivial 8)

I should describe what PCMCIA does to deal with this. PCMCIA cards
are generally not lockable, so drivers need to cope with unplug
notifications whether or not the timing is convenient. Verifying that
"now is a good time" can only be done if the user requests an unplug
in advance, which sends an "eject request" event to all listeners. In
the current design, these listeners include the cardmgr daemon, which
runs user-space checks to see if an eject is safe, though it would be
more foolproof for the client drivers to respond directly. If an
eject happens with no warning, all we can do is notify the client
drivers and let them clean up as best they can. Thus, the "eject
request" handler can return failure, but the "eject" handler cannot
fail.

-- Dave Hinds

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/