Skip to content

Commit 27b13e2

Browse files
Ming Leiaxboe
authored andcommitted
blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
Inside blkg_for_each_descendant_pre(), both css_for_each_descendant_pre() and blkg_lookup() requires RCU read lock, and either cgroup_assert_mutex_or_rcu_locked() or rcu_read_lock_held() is called. Fix the warning by adding rcu read lock. Reported-by: Changhui Zhong <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b0077e2 commit 27b13e2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

block/blk-throttle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global)
13201320
tg_bps_limit(tg, READ), tg_bps_limit(tg, WRITE),
13211321
tg_iops_limit(tg, READ), tg_iops_limit(tg, WRITE));
13221322

1323+
rcu_read_lock();
13231324
/*
13241325
* Update has_rules[] flags for the updated tg's subtree. A tg is
13251326
* considered to have rules if either the tg itself or any of its
@@ -1347,6 +1348,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global)
13471348
this_tg->latency_target = max(this_tg->latency_target,
13481349
parent_tg->latency_target);
13491350
}
1351+
rcu_read_unlock();
13501352

13511353
/*
13521354
* We're already holding queue_lock and know @tg is valid. Let's

0 commit comments

Comments
 (0)