OSDN Git Service

workqueue: make sanity checks less punshing using WARN_ON[_ONCE]()s
authorTejun Heo <tj@kernel.org>
Tue, 12 Mar 2013 18:29:57 +0000 (11:29 -0700)
committerTejun Heo <tj@kernel.org>
Tue, 12 Mar 2013 18:29:57 +0000 (11:29 -0700)
commit6183c009f6cd94b42e5812adcfd4ba6220a196e1
treea0df8377ea42816c541a45fce4a1700f3cb342c1
parentb31041042a8cdece67f925e4bae55b5f5fd754ca
workqueue: make sanity checks less punshing using WARN_ON[_ONCE]()s

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: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
kernel/workqueue.c