Commit b43cb43c authored by Ulrich Obergfell's avatar Ulrich Obergfell Committed by Linus Torvalds

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: default avatarUlrich Obergfell <>
Reviewed-by: default avatarAaron Tomlin <>
Acked-by: default avatarDon Zickus <>
Cc: Ulrich Obergfell <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 58cf690a
......@@ -731,10 +731,17 @@ void lockup_detector_resume(void)
static void update_watchdog_all_cpus(void)
static int update_watchdog_all_cpus(void)
int ret;
ret = watchdog_park_threads();
if (ret)
return ret;
return 0;
static int watchdog_enable_all_cpus(void)
......@@ -753,9 +760,17 @@ static int watchdog_enable_all_cpus(void)
* Enable/disable the lockup detectors or
* change the sample period 'on the fly'.
err = update_watchdog_all_cpus();
if (err) {
pr_err("Failed to update lockup detectors, disabled\n");
if (err)
watchdog_enabled = 0;
return err;
......@@ -851,12 +866,13 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
} while (cmpxchg(&watchdog_enabled, old, new) != old);
* Update the run state of the lockup detectors.
* Restore 'watchdog_enabled' on failure.
* Update the run state of the lockup detectors. There is _no_
* need to check the value returned by proc_watchdog_update()
* and to restore the previous value of 'watchdog_enabled' as
* both lockup detectors are disabled if proc_watchdog_update()
* returns an error.
err = proc_watchdog_update();
if (err)
watchdog_enabled = old;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment