From: Gao Xiang Date: Wed, 27 Nov 2024 08:52:36 +0000 (+0800) Subject: erofs: fix PSI memstall accounting X-Git-Tag: v6.12.7~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0653fa6ee045965f9cae2e9cebcd99ef6b4ecd62;p=thirdparty%2Fkernel%2Fstable.git erofs: fix PSI memstall accounting [ Upstream commit 1a2180f6859c73c674809f9f82e36c94084682ba ] Max Kellermann recently reported psi_group_cpu.tasks[NR_MEMSTALL] is incorrect in the 6.11.9 kernel. The root cause appears to be that, since the problematic commit, bio can be NULL, causing psi_memstall_leave() to be skipped in z_erofs_submit_queue(). Reported-by: Max Kellermann Closes: https://lore.kernel.org/r/CAKPOu+8tvSowiJADW2RuKyofL_CSkm_SuyZA7ME5vMLWmL6pqw@mail.gmail.com Fixes: 9e2f9d34dd12 ("erofs: handle overlapped pclusters out of crafted images properly") Reviewed-by: Chao Yu Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20241127085236.3538334-1-hsiangkao@linux.alibaba.com Signed-off-by: Sasha Levin --- diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index a569ff9dfd044..1a00f061798a3 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1679,9 +1679,9 @@ drain_io: erofs_fscache_submit_bio(bio); else submit_bio(bio); - if (memstall) - psi_memstall_leave(&pflags); } + if (memstall) + psi_memstall_leave(&pflags); /* * although background is preferred, no one is pending for submission.