On 11/28/22 09:06, Michal Koutný wrote:
Hello.
On Sun, Nov 27, 2022 at 10:30:57PM -0500, Waiman Long <longman@xxxxxxxxxx> wrote:
That may not be true if there is no blkg associated with the blkcg. If
css_get() fails, the subsequent css_put() call may lead to data
corruption as was illustrated in a test system that it crashed on
bootup when that commit was included.
Do you have a stacktrace of the underflowing css_put() in
blkcg_destroy_blkgs()?
It looks to me slightly as a mistake of the caller site that it passes
struct blkcg * without any references.
By a cursory look, could it be cgwb_release_workfn?
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -390,11 +390,11 @@ static void cgwb_release_workfn(struct work_struct *work)
wb_shutdown(wb);
css_put(wb->memcg_css);
- css_put(wb->blkcg_css);
mutex_unlock(&wb->bdi->cgwb_release_mutex);
/* triggers blkg destruction if no online users left */
blkcg_unpin_online(wb->blkcg_css);
+ css_put(wb->blkcg_css);
fprop_local_destroy_percpu(&wb->memcg_completions);
Does your crash involve this stack?
That looks like a possible cause for the system crash that we are
seeing. In my testing, I do see one case out of more than a dozen calls
to blkcg_destroy_blkgs() where css_tryget() fail in the reproducing
system during bootup. However, I didn't force a stack dump at that point
and so I am not sure if that is the place, though it looks likely. One
of the crashes that was reported does involve blkcg_unpin_online(). So
maybe that is it.
Cheers,
Longman