Re: [PATCH net-next v2 1/2] net: mana: introduce helper to get a master netdev
From: Konstantin Taranov
Date: Wed Jul 03 2024 - 05:21:25 EST
> > +/* the caller should hold rcu_read_lock */ struct net_device
> > +*mana_get_master_netdev_rcu(struct mana_context *ac, u32 port_index)
> > +{
> > + struct net_device *ndev;
>
> From the comments, this function requires rcu_read_lock. Can the following
> be added in this function?
>
> RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "no rcu read lock held");
>
> If rcu_read_lock is not held, this function will notify the caller.
> This can explicitly ensure that rcu_read_lock should be held before this
> fuction is called.
Thanks! Great idea!
>
> Best Regards,
>
> Zhu Yanjun
>