On Sat, 27 Jun 2009, Rafael J. Wysocki wrote: > > Speaking of races, have you noticed that the way power.work_done gets > > used is racy? > > Not really. :-) > > > You can't wait for the completion before releasing the > > lock, but then anything could happen. > > > > A safer approach would be to use a wait_queue. > > I'm not sure what you mean exactly. What's the race? Come to think of it, there really is a problem here. Because the wait_for_completion call occurs outside the spinlock, it can race with the init_completion call. It's not good for both of them to run at the same time; the completion's internal spinlock and list pointers could get corrupted. Therefore I stand by my original assertion: The struct completion should be replaced with a wait_queue. Set the runtime_error field to -EINPROGRESS initially, and make other threads wait until the value changes. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html