diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2013-12-27 20:17:25 +0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-07-10 20:34:50 +0400 |
commit | a80ca1ae81fc52e304e753f6de4ef248df364f9e (patch) | |
tree | 3e45ac841a66fe27df95d6253cc88be781dd3bd8 /drivers/block/drbd/drbd_worker.c | |
parent | c7a58db4e9dc523b18bbfbc3aa311d8308acc293 (diff) | |
download | linux-a80ca1ae81fc52e304e753f6de4ef248df364f9e.tar.xz |
drbd: fix a race stopping the worker thread
We may implicitly call drbd_send() from inside wait_for_work(),
via maybe_send_barrier().
If the "stop" signal was send just before that, drbd_send() would call
flush_signals(), and we would run an unbounded schedule() afterwards.
Fix: check for thread_state == RUNNING before we schedule()
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_worker.c')
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 59158858b17a..47bc84017b5b 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c @@ -1930,6 +1930,9 @@ static void wait_for_work(struct drbd_connection *connection, struct list_head * if (send_barrier) maybe_send_barrier(connection, connection->send.current_epoch_nr + 1); + /* drbd_send() may have called flush_signals() */ + if (get_t_state(&connection->worker) != RUNNING) + break; schedule(); /* may be woken up for other things but new work, too, * e.g. if the current epoch got closed. |