Commit 09dc3cf9 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Linus Torvalds

printk: avoid double lock acquire

Commit 4f2a8d3c ("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: default avatarAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c193c82f
...@@ -1293,10 +1293,11 @@ void console_unlock(void) ...@@ -1293,10 +1293,11 @@ void console_unlock(void)
raw_spin_lock(&logbuf_lock); raw_spin_lock(&logbuf_lock);
if (con_start != log_end) if (con_start != log_end)
retry = 1; retry = 1;
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
if (retry && console_trylock()) if (retry && console_trylock())
goto again; goto again;
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
if (wake_klogd) if (wake_klogd)
wake_up_klogd(); wake_up_klogd();
} }
......
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