aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/watchdog.c
diff options
context:
space:
mode:
authorUlrich Obergfell <uobergfe@redhat.com>2015-11-05 21:44:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 22:34:48 -0500
commitb43cb43cb85b91d79d9f0719ff581e8cb6dfbb8f (patch)
tree2cf417d680de014bd2d9ff05e148621a9eaabb02 /kernel/watchdog.c
parent58cf690a09987c9a56933df05c0369d691d6224d (diff)
watchdog: implement error handling in update_watchdog_all_cpus() and callers
update_watchdog_all_cpus() now passes errors from watchdog_park_threads() up to functions in the call chain. This allows watchdog_enable_all_cpus() and proc_watchdog_update() to handle such errors too. Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com> Reviewed-by: Aaron Tomlin <atomlin@redhat.com> Acked-by: Don Zickus <dzickus@redhat.com> Cc: Ulrich Obergfell <uobergfe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/watchdog.c')
-rw-r--r--kernel/watchdog.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index f0f8a78512a5..704f93317666 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -731,10 +731,17 @@ void lockup_detector_resume(void)
731 mutex_unlock(&watchdog_proc_mutex); 731 mutex_unlock(&watchdog_proc_mutex);
732} 732}
733 733
734static void update_watchdog_all_cpus(void) 734static int update_watchdog_all_cpus(void)
735{ 735{
736 watchdog_park_threads(); 736 int ret;
737
738 ret = watchdog_park_threads();
739 if (ret)
740 return ret;
741
737 watchdog_unpark_threads(); 742 watchdog_unpark_threads();
743
744 return 0;
738} 745}
739 746
740static int watchdog_enable_all_cpus(void) 747static int watchdog_enable_all_cpus(void)
@@ -753,9 +760,17 @@ static int watchdog_enable_all_cpus(void)
753 * Enable/disable the lockup detectors or 760 * Enable/disable the lockup detectors or
754 * change the sample period 'on the fly'. 761 * change the sample period 'on the fly'.
755 */ 762 */
756 update_watchdog_all_cpus(); 763 err = update_watchdog_all_cpus();
764
765 if (err) {
766 watchdog_disable_all_cpus();
767 pr_err("Failed to update lockup detectors, disabled\n");
768 }
757 } 769 }
758 770
771 if (err)
772 watchdog_enabled = 0;
773
759 return err; 774 return err;
760} 775}
761 776
@@ -851,12 +866,13 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
851 } while (cmpxchg(&watchdog_enabled, old, new) != old); 866 } while (cmpxchg(&watchdog_enabled, old, new) != old);
852 867
853 /* 868 /*
854 * Update the run state of the lockup detectors. 869 * Update the run state of the lockup detectors. There is _no_
855 * Restore 'watchdog_enabled' on failure. 870 * need to check the value returned by proc_watchdog_update()
871 * and to restore the previous value of 'watchdog_enabled' as
872 * both lockup detectors are disabled if proc_watchdog_update()
873 * returns an error.
856 */ 874 */
857 err = proc_watchdog_update(); 875 err = proc_watchdog_update();
858 if (err)
859 watchdog_enabled = old;
860 } 876 }
861out: 877out:
862 mutex_unlock(&watchdog_proc_mutex); 878 mutex_unlock(&watchdog_proc_mutex);