diff mbox series

[linux-next] pstore/ram: Fix pstore lost information

Message ID bd48fa6ca65fadb9ab84a8fec6f0b0ed5e4f2fd4.1723464485.git.chen.haonan2@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series [linux-next] pstore/ram: Fix pstore lost information | expand

Commit Message

chenguanxi11234@163.com Aug. 12, 2024, 1:40 p.m. UTC
From: Chen Haonan <chen.haonan2@zte.com.cn>

persistent_ram_zap() is used to clear relevant log messages 
in dmesg, but in other cases it is not needed.In particular, 
in console and pmsg, it will cause that after we perform 
a delete operation, the next time the system is reset, we
will only see the logs after performing the delete operation.

Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>
---
 fs/pstore/ram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 4311fcbc84f2..4cb6e96df6b9 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -436,7 +436,8 @@  static int ramoops_pstore_erase(struct pstore_record *record)
 	}
 
 	persistent_ram_free_old(prz);
-	persistent_ram_zap(prz);
+	if (record->type == PSTORE_TYPE_DMESG)
+		persistent_ram_zap(prz);
 
 	return 0;
 }