[PATCH] lockdep: misc fixes in lockdep.c
[sfrench/cifs-2.6.git] / kernel / cpu.c
index 27dd3ee47099dd49c26790adf40b42efa1b950a3..9124669f45860cac40c7b03060ef582b94d595ec 100644 (file)
@@ -58,8 +58,8 @@ void unlock_cpu_hotplug(void)
                recursive_depth--;
                return;
        }
-       mutex_unlock(&cpu_bitmask_lock);
        recursive = NULL;
+       mutex_unlock(&cpu_bitmask_lock);
 }
 EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
 
@@ -150,18 +150,18 @@ static int _cpu_down(unsigned int cpu)
        p = __stop_machine_run(take_cpu_down, NULL, cpu);
        mutex_unlock(&cpu_bitmask_lock);
 
-       if (IS_ERR(p)) {
+       if (IS_ERR(p) || cpu_online(cpu)) {
                /* CPU didn't die: tell everyone.  Can't complain. */
                if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
                                (void *)(long)cpu) == NOTIFY_BAD)
                        BUG();
 
-               err = PTR_ERR(p);
-               goto out_allowed;
-       }
-
-       if (cpu_online(cpu))
+               if (IS_ERR(p)) {
+                       err = PTR_ERR(p);
+                       goto out_allowed;
+               }
                goto out_thread;
+       }
 
        /* Wait for it to sleep (leaving idle task). */
        while (!idle_cpu(cpu))
@@ -270,11 +270,7 @@ int disable_nonboot_cpus(void)
                        goto out;
                }
        }
-       error = set_cpus_allowed(current, cpumask_of_cpu(first_cpu));
-       if (error) {
-               printk(KERN_ERR "Could not run on CPU%d\n", first_cpu);
-               goto out;
-       }
+
        /* We take down all of the non-boot CPUs in one shot to avoid races
         * with the userspace trying to use the CPU hotplug at the same time
         */