aboutsummaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-11-14 17:00:16 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 18:45:43 -0800
commit60a0d23386eab0559ad32ae50b200cc58545f327 (patch)
treee80067693fe0600ae8cbb0b550b84ab22f43c4fe /kernel/power
parentc642b8391cf8efc3622cc97329a0f46e7cbb70b8 (diff)
hibernate: fix lockdep report
Lockdep reports a circular locking dependency in the hibernate code because - during system boot hibernate code (from an initcall) locks pm_mutex and then a sysfs buffer mutex via name_to_dev_t - during regular operation hibernate code locks pm_mutex under a sysfs buffer mutex because it's called from sysfs methods. The deadlock can never happen because during initcall invocation nothing can write to sysfs yet. This removes the lockdep report by marking the initcall locking as being in a different class. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Alan Stern <stern@rowland.harvard.edu> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/disk.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 8b15f777010..05b64790fe8 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -456,7 +456,17 @@ static int software_resume(void)
int error;
unsigned int flags;
- mutex_lock(&pm_mutex);
+ /*
+ * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
+ * is configured into the kernel. Since the regular hibernate
+ * trigger path is via sysfs which takes a buffer mutex before
+ * calling hibernate functions (which take pm_mutex) this can
+ * cause lockdep to complain about a possible ABBA deadlock
+ * which cannot happen since we're in the boot code here and
+ * sysfs can't be invoked yet. Therefore, we use a subclass
+ * here to avoid lockdep complaining.
+ */
+ mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
if (!swsusp_resume_device) {
if (!strlen(resume_file)) {
mutex_unlock(&pm_mutex);