erofs: fix PSI memstall accounting

commit 1a2180f685 upstream.

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 <max.kellermann@ionos.com>
Closes: https://lore.kernel.org/r/CAKPOu+8tvSowiJADW2RuKyofL_CSkm_SuyZA7ME5vMLWmL6pqw@mail.gmail.com
Fixes: 9e2f9d34dd ("erofs: handle overlapped pclusters out of crafted images properly")
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20241127085236.3538334-1-hsiangkao@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 14f030a807dd493df577893d4d86562fbc9cbf18)
This commit is contained in:
Gao Xiang 2025-01-08 23:15:20 +08:00 committed by 忘怀
parent 370dbef63e
commit b9fa8ad457
1 changed files with 3 additions and 4 deletions

View File

@ -1730,11 +1730,10 @@ drain_io:
move_to_bypass_jobqueue(pcl, qtail, owned_head);
} while (owned_head != Z_EROFS_PCLUSTER_TAIL);
if (bio) {
if (bio)
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.