Commit b4ad84fc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix deadlock in create_workqueue()

Fix bug identified by Srivatsa Vaddagiri <vatsa@in.ibm.com>:

There's a deadlock in __create_workqueue when CONFIG_HOTPLUG_CPU is set.  This
can happen when create_workqueue_thread fails to create a worker thread.  In
that case, we call destroy_workqueue with cpu hotplug lock held.
destroy_workqueue however also attempts to take the same lock.
parent 7676bfa0
...@@ -334,6 +334,7 @@ struct workqueue_struct *__create_workqueue(const char *name, ...@@ -334,6 +334,7 @@ struct workqueue_struct *__create_workqueue(const char *name,
destroy = 1; destroy = 1;
} }
} }
unlock_cpu_hotplug();
/* /*
* Was there any error during startup? If yes then clean up: * Was there any error during startup? If yes then clean up:
...@@ -342,7 +343,6 @@ struct workqueue_struct *__create_workqueue(const char *name, ...@@ -342,7 +343,6 @@ struct workqueue_struct *__create_workqueue(const char *name,
destroy_workqueue(wq); destroy_workqueue(wq);
wq = NULL; wq = NULL;
} }
unlock_cpu_hotplug();
return wq; return wq;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment