mirror of https://gitee.com/openkylin/linux.git
printk: avoid double lock acquire
Commit 4f2a8d3cf5
("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>
This commit is contained in:
parent
c193c82f05
commit
09dc3cf93f
|
@ -1293,10 +1293,11 @@ void console_unlock(void)
|
|||
raw_spin_lock(&logbuf_lock);
|
||||
if (con_start != log_end)
|
||||
retry = 1;
|
||||
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
|
||||
|
||||
if (retry && console_trylock())
|
||||
goto again;
|
||||
|
||||
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
|
||||
if (wake_klogd)
|
||||
wake_up_klogd();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue