summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-05-18 21:00:05 +0900
committerKees Cook <keescook@chromium.org>2016-05-31 12:36:44 -0700
commit98e44fda2ea19c0e8b0a2e0e4dcd3461251f09ea (patch)
treee467d0b5acdc426d6c1aa4354f12644fb5f453f8 /fs/pstore
parenta1db8060f5c85e33ed810038036f409eed15decc (diff)
downloadlinux-98e44fda2ea19c0e8b0a2e0e4dcd3461251f09ea.tar.bz2
pstore: Enable compression on normal path (again)
The commit f0e2efcfd2717 ("pstore: do not use message compression without lock") added a check to 'is_locked' to avoid breakage in concurrent accesses. But it has a side-effect of disabling compression on normal path since 'is_locked' variable is not set. As normal path always takes the lock, it should be initialized to 1. This also makes the unlock code a bit simpler. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/platform.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index e8c17afdfb41..ad8ef2298047 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -284,7 +284,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
u64 id;
unsigned int part = 1;
unsigned long flags = 0;
- int is_locked = 0;
+ int is_locked;
int ret;
why = get_reason_str(reason);
@@ -295,8 +295,10 @@ static void pstore_dump(struct kmsg_dumper *dumper,
pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
, in_nmi() ? "NMI" : why);
}
- } else
+ } else {
spin_lock_irqsave(&psinfo->buf_lock, flags);
+ is_locked = 1;
+ }
oopscount++;
while (total < kmsg_bytes) {
char *dst;
@@ -350,10 +352,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
total += total_len;
part++;
}
- if (pstore_cannot_block_path(reason)) {
- if (is_locked)
- spin_unlock_irqrestore(&psinfo->buf_lock, flags);
- } else
+ if (is_locked)
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
}