Re: [PATCH AUTOSEL 7.0-6.12] erofs: ensure all folios are managed in erofs_try_to_free_all_cached_folios()

Gao Xiang <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs,dev.linux.lists.patches,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>

On 2026/4/20 21:19, Sasha Levin wrote:
> From: Zhan Xusheng <[email protected]>
> 
> [ Upstream commit 5de6951fedb29700ace53b283ccb951c8f712d12 ]
> 
> folio_trylock() in erofs_try_to_free_all_cached_folios() may
> successfully acquire the folio lock, but the subsequent check
> for erofs_folio_is_managed() can skip unlocking when the folio
> is not managed by EROFS.
> 
> As Gao Xiang pointed out, this condition should not happen in
> practice because compressed_bvecs[] only holds valid cached folios
> at this point — any non-managed folio would have already been
> detached by z_erofs_cache_release_folio() under folio lock.
> 
> Fix this by adding DBG_BUGON() to catch unexpected folios
> and ensure folio_unlock() is always called.
> 
> Suggested-by: Gao Xiang <[email protected]>
> Signed-off-by: Zhan Xusheng <[email protected]>
> Reviewed-by: Gao Xiang <[email protected]>
> Reviewed-by: Chunhai Guo <[email protected]>
> Signed-off-by: Gao Xiang <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
> ---
> 
> LLM Generated explanations, may be completely bogus:
> 
> Now I have a complete picture. Let me compile my analysis.

This is NOT a bugfix, but I don't mind if such random
patch backports to stable kernels.

Thanks,
Gao Xiang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.