Re: [PATCH 1/1] pstore/ram: Check member of buffers during the initialization phase of the pstore

From: Guilherme G. Piccoli
Date: Wed Aug 02 2023 - 11:47:23 EST


On 01/08/2023 03:04, Yunlong Xing wrote:
> [...]

> diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
> index 85aaf0fc6d7d..eb6df190d752 100644
> --- a/fs/pstore/ram_core.c
> +++ b/fs/pstore/ram_core.c
> @@ -519,7 +519,7 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig,
> sig ^= PERSISTENT_RAM_SIG;
>
> if (prz->buffer->sig == sig) {
> - if (buffer_size(prz) == 0) {
> + if (buffer_size(prz) == 0 && buffer_start(prz) == 0) {
> pr_debug("found existing empty buffer\n");

Thanks for the patch! I'd also adjust the above print statement to
reflect the different paths (empty buffers vs illegal one) and maybe
bump it to pr_info, or even pr_warn(_once?).

What do you all think, makes sense or could we pollute dmesg too much?
Cheers!