Whamcloud - gitweb
LU-12362 ptlrpc: use wait_woken() in ptlrpcd()
Using wait_event() to wait for ptlrpcd_check() to succeed is
problematic. ptlrpcd_check() is complex and can wait for other
events. This nested waiting can behave differently to expectation and
generates a warning
do not call blocking ops when !TASK_RUNNING
This happens because the task state is set to TASK_IDLE before
ptlrpcd_check() is calls.
A better approach (introduce for precisely this use-case) is to use
wait_woken() and woken_wake_function().
When a wake_up is requested on the waitq, woken_wake_function() sets a
flag to record the wakeup. wait_woken() will wait until this flag is
set. This way, the task state doesn't need to be set until after
ptlrpcd_check() has completed.
wait_woken() was introduced in Linux 3.19, so libcfs is enhance to
provide the functionality on older kernels.
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Iaddf56e2e76c204435bbef3c857e54ce0a6772bc
Reviewed-on: https://review.whamcloud.com/45069
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: xinliang <xinliang.liu@linaro.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>