• Andrew Morton's avatar
    [PATCH] flush_scheduled_work() deadlock fix · b9b52730
    Andrew Morton authored
    Because keventd is a resource which is shared between unrelated parts of the
    kernel it is possible for one person's workqueue handler to accidentally call
    another person's flush_scheduled_work().  thockin managed it by calling
    mntput() from a workqueue handler.  It deadlocks.
    
    It's simple enough to fix: teach flush_scheduled_work() to go direct when it
    discovers that the calling thread is the one which should be running the
    work.
    
    Note that this can cause recursion.  The depth of that recursion is equal to
    the number of currently-queued works which themselves want to call
    flush_scheduled_work().  If this ever exceeds three I'll eat my hat.
    b9b52730
workqueue.c 8.55 KB