From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mm-commits@vger.kernel.org, stable@vger.kernel.org,
senozhatsky@chromium.org, minchan@kernel.org,
caiqingfu@ruijie.com.cn
Subject: Re: + zram-panic-when-use-ext4-over-zram.patch added to mm-hotfixes-unstable branch
Date: Tue, 10 Dec 2024 18:38:35 +0900 [thread overview]
Message-ID: <20241210093835.GN16709@google.com> (raw)
In-Reply-To: <20241130030456.37C2BC4CECF@smtp.kernel.org>
On (24/11/29 19:04), Andrew Morton wrote:
> --- a/drivers/block/zram/zram_drv.c~zram-panic-when-use-ext4-over-zram
> +++ a/drivers/block/zram/zram_drv.c
> @@ -1633,6 +1633,7 @@ static int zram_write_page(struct zram *
> unsigned long alloced_pages;
> unsigned long handle = -ENOMEM;
> unsigned int comp_len = 0;
> + unsigned int last_comp_len = 0;
> void *src, *dst, *mem;
> struct zcomp_strm *zstrm;
> unsigned long element = 0;
> @@ -1664,6 +1665,11 @@ compress_again:
>
> if (comp_len >= huge_class_size)
> comp_len = PAGE_SIZE;
> +
> + if (last_comp_len && (last_comp_len != comp_len)) {
> + zs_free(zram->mem_pool, handle);
> + handle = (unsigned long)ERR_PTR(-ENOMEM);
> + }
I don't think this needs to be this complex. A simple -ENOMEM should
work, that's the default handle value in this function.
Andrew, can you please fold this in? (Or we can just ask for v2)
---
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 52a005face62..5de7f30d0aa6 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1674,7 +1674,7 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
if (last_comp_len && (last_comp_len != comp_len)) {
zs_free(zram->mem_pool, handle);
- handle = (unsigned long)ERR_PTR(-ENOMEM);
+ handle = -ENOMEM;
}
/*
* handle allocation has 2 paths:
next prev parent reply other threads:[~2024-12-10 9:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-30 3:04 + zram-panic-when-use-ext4-over-zram.patch added to mm-hotfixes-unstable branch Andrew Morton
2024-12-02 7:17 ` Sergey Senozhatsky
2024-12-10 9:38 ` Sergey Senozhatsky [this message]
2024-12-12 8:40 ` Sergey Senozhatsky
2024-12-13 1:15 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241210093835.GN16709@google.com \
--to=senozhatsky@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=caiqingfu@ruijie.com.cn \
--cc=minchan@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox