Re: [PATCH block/for-linus] blkcg: fix botched pd_prealloc error handling in blkcg_activate_policy()
From: Jens Axboe
Date: Tue Oct 15 2019 - 11:52:16 EST
On 10/15/19 9:48 AM, Tejun Heo wrote:
> While fixing ->pd_alloc_fn() bug, ab94b0382d81 ("blkcg: Fix
> ->pd_alloc_fn() being called with the wrong blkcg on policy
> activation") broke the pd_prealloc error handling.
>
> * pd's were freed using kfree(). They should be freed with
> ->pd_free_fn().
>
> * pd_prealloc could be kfree()'d and then ->pd_free_fn()'d again.
>
> * When GFP_KERNEL allocation fails, pinned_blkg wasn't put.
>
> There are also a couple existing issues.
>
> * Each pd is initialized as they get allocated. If alloc fails, the
> policy will get freed with pd's initialized on it.
>
> * After the above partial failure, the partial pds are not freed.
>
> This patch fixes all of the above issues.
I dropped the other one, do you mind sending a folded patch?
--
Jens Axboe