[lkml]   [2005]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: klists and struct device semaphores

On Wed, 6 Apr 2005, Alan Stern wrote:

> The patch looks good. But isn't there still a problem with
> device_release_driver()? It doesn't wait for the klist_node to be removed
> from the klist before unlocking the device and moving on. As a result, if
> another driver was waiting to bind to the device you would corrupt the
> list pointers, by calling klist_add_tail() for the new driver before
> klist_release() had run for the old driver.
> I'll be interested to see how you manage to solve this. The only way I
> can think of is to avoid using driver_for_each_device() in
> driver_detach().

I had implemented something along the lines of what you suggested in a
previous email:

- Add flag to klist_node: n_attached.
- Use that in klist_node_attached()
- Check during klist_next(), and skip nodes that have been removed.
- Reset flag during klist_del().

Based on the deadlock that occurs when using klist_remove() during an
iteration over that the list, and the common indirect usage of it (parents
and buses unregistering devices, drivers unbinding devices), I've just
removed klist_remove() and the embedded completion. I'll post updated
patches soon.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-04-07 22:13    [W:0.052 / U:1.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site