• Tejun Heo's avatar
    workqueue: make sanity checks less punshing using WARN_ON[_ONCE]()s · 6183c009
    Tejun Heo authored
    Workqueue has been using mostly BUG_ON()s for sanity checks, which
    fail unnecessarily harshly when the assertion doesn't hold.  Most
    assertions can converted to be less drastic such that things can limp
    along instead of dying completely.  Convert BUG_ON()s to
    WARN_ON[_ONCE]()s with softer failure behaviors - e.g. if assertion
    check fails in destroy_worker(), trigger WARN and silently ignore
    destruction request.
    
    Most conversions are trivial.  Note that sanity checks in
    destroy_workqueue() are moved above removal from workqueues list so
    that it can bail out without side-effects if assertion checks fail.
    
    This patch doesn't introduce any visible behavior changes during
    normal operation.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
    6183c009
workqueue.c 104 KB