linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pstore: avoid recursive spinlocks in the oops_in_progress case
@ 2012-09-17 17:43 Chuansheng Liu
  2012-09-20 22:57 ` Anton Vorontsov
  0 siblings, 1 reply; 8+ messages in thread
From: Chuansheng Liu @ 2012-09-17 17:43 UTC (permalink / raw)
  To: gregkh, anton.vorontsov; +Cc: keescook, tony.luck, linux-kernel, chuansheng.liu

Like 8250 driver, when pstore is registered as a console,
to avoid recursive spinlocks when panic happening, change the
spin_lock_irqsave to spin_trylock_irqsave when oops_in_progress
is true.

Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
 fs/pstore/platform.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 29996e8..cbcb5fc 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -164,7 +164,12 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
 
 		if (c > psinfo->bufsize)
 			c = psinfo->bufsize;
-		spin_lock_irqsave(&psinfo->buf_lock, flags);
+
+		if (oops_in_progress) {
+			if (!spin_trylock_irqsave(&psinfo->buf_lock, flags))
+				break;
+		} else
+			spin_lock_irqsave(&psinfo->buf_lock, flags);
 		memcpy(psinfo->buf, s, c);
 		psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo);
 		spin_unlock_irqrestore(&psinfo->buf_lock, flags);
-- 
1.7.0.4




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-09-26 23:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17 17:43 [PATCH] pstore: avoid recursive spinlocks in the oops_in_progress case Chuansheng Liu
2012-09-20 22:57 ` Anton Vorontsov
2012-09-20 23:09   ` Luck, Tony
2012-09-20 23:25     ` Anton Vorontsov
2012-09-20 23:48       ` Luck, Tony
2012-09-21  0:37         ` Anton Vorontsov
2012-09-24 15:02           ` Luck, Tony
2012-09-26 23:35             ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).