Skip to content
  • Oleg Nesterov's avatar
    freezer: fix wait_event_freezable/__thaw_task races · 24b7ead3
    Oleg Nesterov authored
    
    
    wait_event_freezable() and friends stop the waiting if try_to_freeze()
    fails. This is not right, we can race with __thaw_task() and in this
    case
    
    	- wait_event_freezable() returns the wrong ERESTARTSYS
    
    	- wait_event_freezable_timeout() can return the positive
    	  value while condition == F
    
    Change the code to always check __retval/condition before return.
    
    Note: with or without this patch the timeout logic looks strange,
    probably we should recalc timeout if try_to_freeze() returns T.
    
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Acked-by: default avatarTejun Heo <tj@kernel.org>
    24b7ead3