Skip to content

Commit 393cd8f

Browse files
Ming Leiaxboe
authored andcommitted
blk-cgroup: fix rcu lockdep warning in blkg_lookup()
blkg_lookup() is called with either queue_lock or rcu read lock, so use rcu_dereference_check(lockdep_is_held(&q->queue_lock)) for retrieving 'blkg', which way models the check exactly for covering queue lock or rcu read lock. Fix lockdep warning of "block/blk-cgroup.h:254 suspicious rcu_dereference_check() usage!" from blkg_lookup(). Tested-by: Changhui Zhong <[email protected]> Signed-off-by: Ming Lei <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Fixes: 83462a6 ("blkcg: Drop unnecessary RCU read [un]locks from blkg_conf_prep/finish()") Acked-by: Tejun Heo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent fab4c16 commit 393cd8f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/blk-cgroup.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg,
252252
if (blkcg == &blkcg_root)
253253
return q->root_blkg;
254254

255-
blkg = rcu_dereference(blkcg->blkg_hint);
255+
blkg = rcu_dereference_check(blkcg->blkg_hint,
256+
lockdep_is_held(&q->queue_lock));
256257
if (blkg && blkg->q == q)
257258
return blkg;
258259

0 commit comments

Comments
 (0)