Re: [PATCH] blk-cgroup: fix rcu lockdep warning in blkg_lookup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 19, 2023 at 9:28 AM Ming Lei <ming.lei@xxxxxxxxxx> wrote:
>
> 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 <czhong@xxxxxxxxxx>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> ---
>  block/blk-cgroup.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
> index fd482439afbc..b927a4a0ad03 100644
> --- a/block/blk-cgroup.h
> +++ b/block/blk-cgroup.h
> @@ -252,7 +252,8 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg,
>         if (blkcg == &blkcg_root)
>                 return q->root_blkg;
>
> -       blkg = rcu_dereference(blkcg->blkg_hint);
> +       blkg = rcu_dereference_check(blkcg->blkg_hint,
> +                       lockdep_is_held(&q->queue_lock));
>         if (blkg && blkg->q == q)
>                 return blkg;

Hello,

Ping...

Thanks,






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux