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 <[email protected]>
Cc: Marcin Slusarz <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • 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.