> Subject: [EXTERNAL] Re: [Patch rdma-next] RDMA/mana_ib: handle net event
> for pointing to the current netdev
> 
> On Fri, Feb 28, 2025 at 02:41:59PM -0800, lon...@linuxonhyperv.com wrote:
> > +   struct mana_ib_dev *dev = container_of(this, struct mana_ib_dev,
> nb);
> > +   struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
> > +   struct gdma_context *gc = dev->gdma_dev->gdma_context;
> > +   struct mana_context *mc = gc->mana.driver_data;
> > +   struct net_device *ndev;
> > +
> > +   if (event_dev != mc->ports[0])
> > +           return NOTIFY_DONE;
> > +
> > +   switch (event) {
> > +   case NETDEV_CHANGEUPPER:
> > +           rcu_read_lock();
> > +           ndev = mana_get_primary_netdev_rcu(mc, 0);
> > +           rcu_read_unlock();
> 
> That locking sure looks weird/wrong.
> 
> Jason

I think the locking is necessary as mana_get_primary_netdev_rcu() requires a 
RCU lock. It's safe to nest rcu_read_lock() if it's already held.

I have sent v2. v1 is from an earlier branch and is missing some error handling 
code.

Thanks,
Long

Reply via email to