pstore: Remove needless lock during console writes
authorKees Cook <keescook@chromium.org>
Thu, 1 Nov 2018 21:08:07 +0000 (14:08 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 4 Dec 2018 00:52:35 +0000 (16:52 -0800)
Since the console writer does not use the preallocated crash dump buffer
any more, there is no reason to perform locking around it.

Fixes: 70ad35db3321 ("pstore: Convert console write to use ->write_buf")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
fs/pstore/platform.c

index 8b6028948cf317534f3f961ad53cb035ac4e4cdf..a75756c48e10b8624143474d145debf43c51349d 100644 (file)
@@ -462,31 +462,14 @@ static void pstore_unregister_kmsg(void)
 #ifdef CONFIG_PSTORE_CONSOLE
 static void pstore_console_write(struct console *con, const char *s, unsigned c)
 {
-       const char *e = s + c;
+       struct pstore_record record;
 
-       while (s < e) {
-               struct pstore_record record;
-               unsigned long flags;
-
-               pstore_record_init(&record, psinfo);
-               record.type = PSTORE_TYPE_CONSOLE;
-
-               if (c > psinfo->bufsize)
-                       c = psinfo->bufsize;
+       pstore_record_init(&record, psinfo);
+       record.type = PSTORE_TYPE_CONSOLE;
 
-               if (oops_in_progress) {
-                       if (!spin_trylock_irqsave(&psinfo->buf_lock, flags))
-                               break;
-               } else {
-                       spin_lock_irqsave(&psinfo->buf_lock, flags);
-               }
-               record.buf = (char *)s;
-               record.size = c;
-               psinfo->write(&record);
-               spin_unlock_irqrestore(&psinfo->buf_lock, flags);
-               s += c;
-               c = e - s;
-       }
+       record.buf = (char *)s;
+       record.size = c;
+       psinfo->write(&record);
 }
 
 static struct console pstore_console = {