Whamcloud - gitweb
LU-12780 target: don't use ptlrpc_thread for txn_commit_thread 60/36260/10
authorMr NeilBrown <neilb@suse.de>
Wed, 23 Oct 2019 00:30:49 +0000 (11:30 +1100)
committerOleg Drokin <green@whamcloud.com>
Thu, 7 May 2020 05:45:19 +0000 (05:45 +0000)
commit8bbcfedcba1d5e4401bcfd8e60936efea262d562
treec5ab3f1dec2aaa58c36c49ef26a9b827be13c883
parent6e1c48c4b7224f28b2aebcb372dc1156f09268f6
LU-12780 target: don't use ptlrpc_thread for txn_commit_thread

rather than ptlrpc_thread, use native kthreads functionality.

- there is no need to synchronize on startup, the initialization
  can be done before the thread is started.  This requires adding
  an lu_env to struct target_distribute_txn_data so
  distribute_txn_init() can set it up before starting the thread.

- correspondingly, the cleanup is best done outside of the thread too,
  as it is possible for kthread_stop() to stop a thread before
  the function is called even once.  So the lu_env_fini is moved to
  distrbute_txn_fini().  and ->tdtd_list is cleaned up there too
  just incase the thread didn't have a chance to run.

- kthread_stop/kthread_should_stop is used to synchornize
  shutdown

- signaling the thread is done with wake_up_process().
  The thread sets TASK_IDLE at the top of the loop, then
  sets TASK_RUNNING if it finds anything to do, and finally
  calls schedule() at the end.  This makes
  tdtd_ready_for_cancel_log() unnecesary as it just duplicates
  checks that are already present in distribute_txn_commit_thread().

Change-Id: I06c3686b90faa6c6b638b8d6c69cd4e05c2783f4
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/36260
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_target.h
lustre/target/update_trans.c