rcutorture: Add end-of-test check to rcu_torture_fwd_prog() loop
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 17 Dec 2021 23:05:05 +0000 (15:05 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 2 Feb 2022 01:24:38 +0000 (17:24 -0800)
The second and subsequent forward-progress kthreads loop waiting for
the first forward-progress kthread to start the next test interval.
Unfortunately, if the test ends while one of those kthreads is waiting,
the test will hang.  This hang occurs because that wait loop fails to
check for the end of the test.  This commit therefore adds an end-of-test
check to that wait loop.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcutorture.c

index afe95c694895743e8359b5f1d4e7e54dc092df59..e99658efd97f4d5e207f897af17c0c4ff7bea6dd 100644 (file)
@@ -2515,7 +2515,7 @@ static int rcu_torture_fwd_prog(void *args)
                        firsttime = false;
                        WRITE_ONCE(rcu_fwd_seq, rcu_fwd_seq + 1);
                } else {
-                       while (READ_ONCE(rcu_fwd_seq) == oldseq)
+                       while (READ_ONCE(rcu_fwd_seq) == oldseq && !torture_must_stop())
                                schedule_timeout_interruptible(1);
                        oldseq = READ_ONCE(rcu_fwd_seq);
                }