On Wed, 9 Mar 2005, Alan Stern wrote: > This is a complex scheme. But it has to be; there's no way for > device_attach, driver_attach, and driver_detach to iterate through the > lists reliably if the lists are subject to concurrent change. If the > lists are busy, these routines have only two choices. They can either > queue a request for an update and return immediately, or else wait until > the lists aren't busy -- which is exactly what the current rwsem scheme > does. > > Comments? Yes. First of all, this is a totally different topic than suspend/resume. Secondly, discussion about locking issues and fixes are *much* harder to do with prose, and *much* easier to express with code. If you get the code right, it speaks for itself. Finally, there is an elegant solution to this problem that I'm trying to update the patches for. Basically, it extends struct list_head to have a reference count, where it can only be removed when it hits 0. A spinlock is held while grabbing and incrementing the reference for each node (and decrementing the count for the previous held node). The lock is dropped and a callback called, which can then sleep and modify the list that the node sits on. Updated patch coming soon. Pat