When we activate policy on the request_queue, we will create policy_date
for all the existing blkgs of the request_queue, so we should call
pd_init_fn() and pd_online_fn() on these newly created policy_data.

Signed-off-by: Zhou Chengming <zhouchengmi...@huawei.com>
---
 block/blk-cgroup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 8ba0af7..1eba1d2 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
                pd->plid = pol->plid;
                if (pol->pd_init_fn)
                        pol->pd_init_fn(pd);
+
+               if (pol->pd_online_fn) {
+                       spin_lock(&blkg->blkcg->lock);
+                       pol->pd_online_fn(pd);
+                       spin_unlock(&blkg->blkcg->lock);
+               }
        }
 
        __set_bit(pol->plid, q->blkcg_pols);
-- 
1.8.3.1

Reply via email to