From: Greg KH <gregkh@linuxfoundation.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: stable@vger.kernel.org,
Chengming Zhou <zhouchengming@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Nhat Pham <nphamcs@gmail.com>,
Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: zswap: fix missing folio cleanup in writeback race path
Date: Tue, 27 Feb 2024 11:17:52 +0100 [thread overview]
Message-ID: <2024022730-passenger-moonlike-62f3@gregkh> (raw)
In-Reply-To: <CAJD7tkYYWPWA-3fGAjMOqVy+8Mcwq++6yw0R6odeOsByugre+Q@mail.gmail.com>
On Tue, Feb 27, 2024 at 12:58:27AM -0800, Yosry Ahmed wrote:
> On Tue, Feb 27, 2024 at 12:55 AM Greg KH <greg@kroah.com> wrote:
> >
> > On Mon, Feb 26, 2024 at 10:10:17PM +0000, Yosry Ahmed wrote:
> > > In zswap_writeback_entry(), after we get a folio from
> > > __read_swap_cache_async(), we grab the tree lock again to check that the
> > > swap entry was not invalidated and recycled. If it was, we delete the
> > > folio we just added to the swap cache and exit.
> > >
> > > However, __read_swap_cache_async() returns the folio locked when it is
> > > newly allocated, which is always true for this path, and the folio is
> > > ref'd. Make sure to unlock and put the folio before returning.
> > >
> > > This was discovered by code inspection, probably because this path handles
> > > a race condition that should not happen often, and the bug would not crash
> > > the system, it will only strand the folio indefinitely.
> > >
> > > Link: https://lkml.kernel.org/r/20240125085127.1327013-1-yosryahmed@google.com
> > > Fixes: 04fc7816089c ("mm: fix zswap writeback race condition")
> > > Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
> > > Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
> > > Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> > > Reviewed-by: Nhat Pham <nphamcs@gmail.com>
> > > Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
> > > Cc: <stable@vger.kernel.org>
> > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > > (cherry picked from commit e3b63e966cac0bf78aaa1efede1827a252815a1d)
> > > Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
> >
> > What tree is this for?
>
> This is for 6.6.y, sorry I messed up the subject prefix. Do I need to resend?
Ah, here is the 6.6.y version, missed it, sorry for the noise. I'll go
queue this and the 6.1.y version up now.
thanks,
greg k-h
next prev parent reply other threads:[~2024-02-27 10:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 10:30 FAILED: patch "[PATCH] mm: zswap: fix missing folio cleanup in writeback race path" failed to apply to 6.6-stable tree gregkh
2024-02-26 22:10 ` [PATCH] mm: zswap: fix missing folio cleanup in writeback race path Yosry Ahmed
2024-02-27 8:55 ` Greg KH
2024-02-27 8:58 ` Yosry Ahmed
2024-02-27 10:17 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-25 8:51 Yosry Ahmed
2024-01-25 8:54 ` Chengming Zhou
2024-01-25 14:49 ` Johannes Weiner
2024-01-25 18:29 ` Nhat Pham
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=2024022730-passenger-moonlike-62f3@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=nphamcs@gmail.com \
--cc=stable@vger.kernel.org \
--cc=yosryahmed@google.com \
--cc=zhouchengming@bytedance.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