Skip to content

Commit

Permalink
watchdog: Only disable/enable watchdog if neccessary
Browse files Browse the repository at this point in the history
Don't take any action on an unsuccessful write to /proc.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1306127423-3347-2-git-send-email-msb@chromium.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Mandeep Singh Baines authored and Ingo Molnar committed May 23, 2011
1 parent 824c6b7 commit e04ab2b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions kernel/watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,15 +507,19 @@ static void watchdog_disable_all_cpus(void)
int proc_dowatchdog_enabled(struct ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
{
proc_dointvec(table, write, buffer, length, ppos);
int ret;

if (write) {
if (watchdog_enabled)
watchdog_enable_all_cpus();
else
watchdog_disable_all_cpus();
}
return 0;
ret = proc_dointvec(table, write, buffer, length, ppos);
if (ret || !write)
goto out;

if (watchdog_enabled)
watchdog_enable_all_cpus();
else
watchdog_disable_all_cpus();

out:
return ret;
}

int proc_dowatchdog_thresh(struct ctl_table *table, int write,
Expand Down

0 comments on commit e04ab2b

Please sign in to comment.