android_kernel_google_msm/include
Imre Deak 954dc41937 wait: fix false timeouts when using wait_event_timeout()
commit 4c663cfc52 upstream.

Many callers of the wait_event_timeout() and
wait_event_interruptible_timeout() expect that the return value will be
positive if the specified condition becomes true before the timeout
elapses.  However, at the moment this isn't guaranteed.  If the wake-up
handler is delayed enough, the time remaining until timeout will be
calculated as 0 - and passed back as a return value - even if the
condition became true before the timeout has passed.

Fix this by returning at least 1 if the condition becomes true.  This
semantic is in line with what wait_for_condition_timeout() does; see
commit bb10ed09 ("sched: fix wait_for_completion_timeout() spurious
failure under heavy load").

Daniel said "We have 3 instances of this bug in drm/i915.  One case even
where we switch between the interruptible and not interruptible
wait_event_timeout variants, foolishly presuming they have the same
semantics.  I very much like this."

One such bug is reported at
  https://bugs.freedesktop.org/show_bug.cgi?id=64133

Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: "Paul E.  McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-07 12:49:14 -07:00
..
acpi
asm-generic mm: allow arch code to control the user page table ceiling 2013-05-07 19:51:55 -07:00
crypto
drm drm/radeon: add new richland pci ids 2013-05-11 13:48:14 -07:00
keys
linux wait: fix false timeouts when using wait_event_timeout() 2013-06-07 12:49:14 -07:00
math-emu
media
misc
mtd
net ipv6: do not clear pinet6 field 2013-05-19 10:54:47 -07:00
pcmcia
rdma infiniband: pass rdma_cm module to netlink_dump_start 2012-10-28 10:14:15 -07:00
rxrpc
scsi
sound ALSA: Add a reference counter to card instance 2012-11-17 13:16:13 -08:00
target target: Add link_magic for fabric allow_link destination target_items 2013-01-21 11:45:24 -08:00
trace xen/mmu: Use Xen specific TLB flush instead of the generic one. 2012-11-17 13:15:54 -08:00
video atmel_lcdfb: fix 16-bpp modes on older SOCs 2013-03-20 13:05:00 -07:00
xen xen/blkback: correctly respond to unknown, non-native requests 2013-04-05 10:04:18 -07:00
Kbuild