Skip to content
  • NeilBrown's avatar
    md/raid1,raid10: silence warning about wait-within-wait · 474beb57
    NeilBrown authored
    
    
    If you prepare_to_wait() after a previous prepare_to_wait(),
    but before calling schedule(), you get warning:
    
      do not call blocking ops when !TASK_RUNNING; state=2
    
    This is appropriate as it is often a bug.  The event that the
    first prepare_to_wait() expects might wake up the schedule following
    the second prepare_to_wait(), which could be confusing.
    
    However if both prepare_to_wait()s are part of simple wait_event()
    loops, and if the inner one is rarely called, then there is
    no problem.  The inner loop is too simple to get confused by
    a stray wakeup, and the outer loop won't spin unduly because the
    inner doesnt affect it often.
    
    This pattern occurs in both raid1.c and raid10.c in the use of
    flush_pending_writes().
    
    The warning can be silenced by setting current->state to TASK_RUNNING.
    
    Signed-off-by: default avatarNeilBrown <neilb@suse.com>
    Signed-off-by: default avatarShaohua Li <shli@fb.com>
    474beb57