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

chenguanxi11234@163.com posted 1 patch 1 year, 5 months ago
There is a newer version of this series
fs/pstore/ram.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH linux-next] pstore/ram: Fix pstore lost information
Posted by chenguanxi11234@163.com 1 year, 5 months ago
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 --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;
 }
-- 
2.25.1