From: Matthew Wilcox <willy@infradead.org>
To: Nhat Pham <nphamcs@gmail.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
yosryahmed@google.com, yosry.ahmed@linux.dev,
chengming.zhou@linux.dev, linux-mm@kvack.org,
kernel-team@meta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] page_io: zswap: do not crash the kernel on decompression failure
Date: Mon, 12 May 2025 20:03:11 +0100 [thread overview]
Message-ID: <aCJF74ILruXJOAkQ@casper.infradead.org> (raw)
In-Reply-To: <20250306205011.784787-1-nphamcs@gmail.com>
On Thu, Mar 06, 2025 at 12:50:10PM -0800, Nhat Pham wrote:
> -static void zswap_decompress(struct zswap_entry *entry, struct folio *folio)
> +static bool zswap_decompress(struct zswap_entry *entry, struct folio *folio)
Hm, why do it this way? I had it as:
-static void zswap_decompress(struct zswap_entry *entry, struct folio *folio)
+static int zswap_decompress(struct zswap_entry *entry, struct folio *folio)
...
+ err = crypto_acomp_decompress(acomp_ctx->req);
+ err = crypto_wait_req(err, &acomp_ctx->wait);
+ if (!err && acomp_ctx->req->dlen != PAGE_SIZE)
+ err = -EIO;
which allows us to return something more meaningful than -EIO. Or is
doing that a bad idea and we should squash all decompression failures
to EIO?
(also i really dislike the chained approach:
decomp_ret = crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait);
that's much harder to understand than the two lines i have above)
next prev parent reply other threads:[~2025-05-12 19:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 20:50 Nhat Pham
2025-03-06 21:32 ` Yosry Ahmed
2025-03-06 22:08 ` Nhat Pham
2025-03-06 22:24 ` [PATCH v4] page_io: zswap: do not crash the kernel on decompression failure (fix) Nhat Pham
2025-03-07 1:35 ` [PATCH v4] page_io: zswap: do not crash the kernel on decompression failure Johannes Weiner
2025-03-07 3:06 ` Chengming Zhou
2025-05-12 19:03 ` Matthew Wilcox [this message]
2025-05-12 19:49 ` Nhat Pham
2025-05-12 20:42 ` Matthew Wilcox
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=aCJF74ILruXJOAkQ@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=yosry.ahmed@linux.dev \
--cc=yosryahmed@google.com \
/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