summaryrefslogtreecommitdiff
path: root/fs/dlm/recoverd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-15 01:06:51 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-15 01:06:51 +0300
commitf0b60bfa952458286f43a63c07b0eea170b2cc95 (patch)
treefc326d55acf307786fde06cc7e2daeff713ff715 /fs/dlm/recoverd.c
parent29309a4eb8a2a9163b20657ce30510406c792d79 (diff)
parent9250e523592a8ced3ecd14abe29fbb1e036bd7eb (diff)
downloadlinux-f0b60bfa952458286f43a63c07b0eea170b2cc95.tar.xz
Merge tag 'dlm-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: "This set focuses, as usual, on fixes to the comms layer. New testing of the dlm with ocfs2 uncovered a number of bugs in the TCP connection handling during recovery, starting, and stopping" * tag 'dlm-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: dlm: remove dlm_send_rcom_lookup_dump dlm: recheck kthread_should_stop() before schedule() DLM: fix NULL pointer dereference in send_to_sock() DLM: fix to reschedule rwork DLM: fix to use sk_callback_lock correctly DLM: fix overflow dlm_cb_seq DLM: fix memory leak in tcp_accept_from_sock() DLM: fix conversion deadlock when DLM_LKF_NODLCKWT flag is set DLM: use CF_CLOSE flag to stop dlm_send correctly DLM: Reanimate CF_WRITE_PENDING flag DLM: fix race condition between dlm_recoverd_stop and dlm_recoverd DLM: close othercon at send/receive error DLM: retry rcom when dlm_wait_function is timed out. DLM: fix to use sock_mutex correctly in xxx_accept_from_sock DLM: fix race condition between dlm_send and dlm_recv DLM: fix double list_del() DLM: fix remove save_cb argument from add_sock() DLM: Fix saving of NULL callbacks DLM: Eliminate CF_WRITE_PENDING flag DLM: Eliminate CF_CONNECT_PENDING flag
Diffstat (limited to 'fs/dlm/recoverd.c')
-rw-r--r--fs/dlm/recoverd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/dlm/recoverd.c b/fs/dlm/recoverd.c
index 6859b4bf971e..6f4e1d42d733 100644
--- a/fs/dlm/recoverd.c
+++ b/fs/dlm/recoverd.c
@@ -287,11 +287,23 @@ static int dlm_recoverd(void *arg)
set_bit(LSFL_RECOVER_LOCK, &ls->ls_flags);
wake_up(&ls->ls_recover_lock_wait);
- while (!kthread_should_stop()) {
+ while (1) {
+ /*
+ * We call kthread_should_stop() after set_current_state().
+ * This is because it works correctly if kthread_stop() is
+ * called just before set_current_state().
+ */
set_current_state(TASK_INTERRUPTIBLE);
+ if (kthread_should_stop()) {
+ set_current_state(TASK_RUNNING);
+ break;
+ }
if (!test_bit(LSFL_RECOVER_WORK, &ls->ls_flags) &&
- !test_bit(LSFL_RECOVER_DOWN, &ls->ls_flags))
+ !test_bit(LSFL_RECOVER_DOWN, &ls->ls_flags)) {
+ if (kthread_should_stop())
+ break;
schedule();
+ }
set_current_state(TASK_RUNNING);
if (test_and_clear_bit(LSFL_RECOVER_DOWN, &ls->ls_flags)) {