sched/wait: Fix the signal handling fix

Jan Stancek reported that I wrecked things for him by fixing things for
Vladimir :/

His report was due to an UNINTERRUPTIBLE wait getting -EINTR, which
should not be possible, however my previous patch made this possible by
unconditionally checking signal_pending().

We cannot use current->state as was done previously, because the
instruction after the store to that variable it can be changed.  We must
instead pass the initial state along and use that.

Fixes: 68985633bccb ("sched/wait: Fix signal handling in bit wait helpers")
Reported-by: Jan Stancek <>
Reported-by: Chris Mason <>
Tested-by: Jan Stancek <>
Tested-by: Vladimir Murzin <>
Tested-by: Chris Mason <>
Reviewed-by: Paul Turner <>
Cc: Ingo Molnar <>
Cc: Oleg Nesterov <>
Signed-off-by: Peter Zijlstra (Intel) <>
Signed-off-by: Linus Torvalds <>
8 files changed