Whamcloud - gitweb
LU-12780 quota: don't use ptlrpc_thread for qmt_reba_thread 56/36556/6
authorMr NeilBrown <neilb@suse.de>
Wed, 23 Oct 2019 00:30:52 +0000 (11:30 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 7 Apr 2020 17:18:43 +0000 (17:18 +0000)
commit43046d2732a33f81390901acc87fb28920d3864f
tree707a48dd0fb601afb08255ec2505fa5355983a91
parent0f1743916be6605fcd8f57993d6ce7d8d06ce12c
LU-12780 quota: don't use ptlrpc_thread for qmt_reba_thread

Instead of ptlrpc_thread, use native kthread functionality.

- for startup, perform allocations before creating the thread so that
  once created it cannot fail.
  We still use a completion to ensure the thread function runs before
  kthread_stop is called, so that cleanup will happen.

- As lu_env_add() can fail, and needs to know which task owns
  the env, we add a new function lu_env_add_task()

- for shutdown, use kthread_stop() and kthread_should_stop()

- to alert thread of a new event, use wake_up_process()
  Do this under qmt_reba_lock so the thread cannot disappear while
  being woken.
  The thread sets TASK_IDLE, then if any tests show there is work
  to do it sets TASK_RUNNING, so the following schedule() won't
  block and the loop will check again.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: If3f0444d5aa38ea84990d95f85ad18202f99d5df
Reviewed-on: https://review.whamcloud.com/36556
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/obdclass/lu_object.c
lustre/quota/qmt_dev.c
lustre/quota/qmt_internal.h
lustre/quota/qmt_lock.c