watchdog: Fix sysctl consistency
authorMarcin Slusarz <[email protected]>
Fri, 28 Jan 2011 16:00:32 +0000 (11:00 -0500)
committerIngo Molnar <[email protected]>
Mon, 31 Jan 2011 12:22:43 +0000 (13:22 +0100)
If it was not possible to enable watchdog for any cpu, switch
watchdog_enabled back to 0, because it's visible via
kernel.watchdog sysctl.

Signed-off-by: Marcin Slusarz <[email protected]>
Signed-off-by: Don Zickus <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: <[email protected]>
LKML-Reference: <1296230433[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/watchdog.c

index d9961ea1c3f4934da9d8e051c99df5a99d4b0b52..c7e0049344bd6eb069a3542a90b1994cd621d917 100644 (file)
@@ -429,9 +429,6 @@ static int watchdog_enable(int cpu)
                wake_up_process(p);
        }
 
-       /* if any cpu succeeds, watchdog is considered enabled for the system */
-       watchdog_enabled = 1;
-
        return 0;
 }
 
@@ -459,12 +456,16 @@ static void watchdog_disable(int cpu)
 static void watchdog_enable_all_cpus(void)
 {
        int cpu;
-       int result = 0;
+
+       watchdog_enabled = 0;
 
        for_each_online_cpu(cpu)
-               result += watchdog_enable(cpu);
+               if (!watchdog_enable(cpu))
+                       /* if any cpu succeeds, watchdog is considered
+                          enabled for the system */
+                       watchdog_enabled = 1;
 
-       if (result)
+       if (!watchdog_enabled)
                printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n");
 
 }