Commit c59ab97e9ecdee9084d2da09e5a8ceea9a396508
Committed by
Ingo Molnar
1 parent
ea7d3fef42
Exists in
master
and in
4 other branches
rcu: fix rcutorture bug
Fix an rcutorture bug that prevents the shutdown notifier from ever actually having any effect, due to the fact that kthreads ignore all signals. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 8 additions and 10 deletions Side-by-side Diff
kernel/rcutorture.c
... | ... | @@ -136,7 +136,7 @@ |
136 | 136 | #endif |
137 | 137 | int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT; |
138 | 138 | |
139 | -#define FULLSTOP_SIGNALED 1 /* Bail due to signal. */ | |
139 | +#define FULLSTOP_SHUTDOWN 1 /* Bail due to system shutdown/panic. */ | |
140 | 140 | #define FULLSTOP_CLEANUP 2 /* Orderly shutdown. */ |
141 | 141 | static int fullstop; /* stop generating callbacks at test end. */ |
142 | 142 | DEFINE_MUTEX(fullstop_mutex); /* protect fullstop transitions and */ |
... | ... | @@ -151,12 +151,10 @@ |
151 | 151 | { |
152 | 152 | if (fullstop) |
153 | 153 | return NOTIFY_DONE; |
154 | - if (signal_pending(current)) { | |
155 | - mutex_lock(&fullstop_mutex); | |
156 | - if (!ACCESS_ONCE(fullstop)) | |
157 | - fullstop = FULLSTOP_SIGNALED; | |
158 | - mutex_unlock(&fullstop_mutex); | |
159 | - } | |
154 | + mutex_lock(&fullstop_mutex); | |
155 | + if (!fullstop) | |
156 | + fullstop = FULLSTOP_SHUTDOWN; | |
157 | + mutex_unlock(&fullstop_mutex); | |
160 | 158 | return NOTIFY_DONE; |
161 | 159 | } |
162 | 160 | |
... | ... | @@ -624,7 +622,7 @@ |
624 | 622 | rcu_stutter_wait(); |
625 | 623 | } while (!kthread_should_stop() && !fullstop); |
626 | 624 | VERBOSE_PRINTK_STRING("rcu_torture_writer task stopping"); |
627 | - while (!kthread_should_stop() && fullstop != FULLSTOP_SIGNALED) | |
625 | + while (!kthread_should_stop() && fullstop != FULLSTOP_SHUTDOWN) | |
628 | 626 | schedule_timeout_uninterruptible(1); |
629 | 627 | return 0; |
630 | 628 | } |
... | ... | @@ -649,7 +647,7 @@ |
649 | 647 | } while (!kthread_should_stop() && !fullstop); |
650 | 648 | |
651 | 649 | VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task stopping"); |
652 | - while (!kthread_should_stop() && fullstop != FULLSTOP_SIGNALED) | |
650 | + while (!kthread_should_stop() && fullstop != FULLSTOP_SHUTDOWN) | |
653 | 651 | schedule_timeout_uninterruptible(1); |
654 | 652 | return 0; |
655 | 653 | } |
... | ... | @@ -759,7 +757,7 @@ |
759 | 757 | VERBOSE_PRINTK_STRING("rcu_torture_reader task stopping"); |
760 | 758 | if (irqreader && cur_ops->irqcapable) |
761 | 759 | del_timer_sync(&t); |
762 | - while (!kthread_should_stop() && fullstop != FULLSTOP_SIGNALED) | |
760 | + while (!kthread_should_stop() && fullstop != FULLSTOP_SHUTDOWN) | |
763 | 761 | schedule_timeout_uninterruptible(1); |
764 | 762 | return 0; |
765 | 763 | } |