summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChuansheng Liu <chuansheng.liu@intel.com>2012-09-18 01:43:44 +0800
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-09-20 17:04:50 -0700
commit80c9d03c22f13a17df67b4b99a83ed5e9acf6093 (patch)
treef12fb83065cf66ca699173a3520d5a37b7860054 /fs
parent65f8c95e46a1827ae8bbc52a817ea308dd7d65ae (diff)
downloadkernel-common-80c9d03c22f13a17df67b4b99a83ed5e9acf6093.tar.gz
kernel-common-80c9d03c22f13a17df67b4b99a83ed5e9acf6093.tar.bz2
kernel-common-80c9d03c22f13a17df67b4b99a83ed5e9acf6093.zip
pstore: Avoid recursive spinlocks in the oops_in_progress case
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> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/pstore/platform.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 6c23eab7f76c..a40da07e93d6 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -164,7 +164,13 @@ 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);