diff options
author | Peter Zijlstra <peterz@infradead.org> | 2011-12-08 17:34:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-09 10:50:28 -0500 |
commit | 09dc3cf93f7d16fdd37a0ad8486faebb5e2769ec (patch) | |
tree | 4db1b0103db218d0d0aa26a26232c3674dd18622 /kernel/printk.c | |
parent | c193c82f054195aa352ccbef91afc28446e5a30e (diff) |
printk: avoid double lock acquire
Commit 4f2a8d3cf5e ("printk: Fix console_sem vs logbuf_lock unlock race")
introduced another silly bug where we would want to acquire an already
held lock. Avoid this.
Reported-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 1455a0d4eedd..7982a0a841ea 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -1293,10 +1293,11 @@ again: | |||
1293 | raw_spin_lock(&logbuf_lock); | 1293 | raw_spin_lock(&logbuf_lock); |
1294 | if (con_start != log_end) | 1294 | if (con_start != log_end) |
1295 | retry = 1; | 1295 | retry = 1; |
1296 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
1297 | |||
1296 | if (retry && console_trylock()) | 1298 | if (retry && console_trylock()) |
1297 | goto again; | 1299 | goto again; |
1298 | 1300 | ||
1299 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
1300 | if (wake_klogd) | 1301 | if (wake_klogd) |
1301 | wake_up_klogd(); | 1302 | wake_up_klogd(); |
1302 | } | 1303 | } |