Subject: Re: [PATCH net-next v6 1/4] netdevsim: allow two netdevsim ports to be connected

From: Jakub Kicinski <[email-masked]>
Date: Fri, 26 Jan 2024 11:17:44 -0800

On Fri, 26 Jan 2024 10:54:35 -0800 David Wei wrote:
> > since you're under rtnl_lock you can use __get_device_by_index(),
> > it doesn't increase the refcount so you won't have to worry about
> > releasing it.  
> 
> Ah, I will change this. Is this true in general i.e. if I hold some big
> lock then I can use versions of functions that do not modify refcounts?

I don't think so, generally you can ignore refcounts if you're holding
the lock protecting the table in which the object is registered while
it is alive, and you just looked it up in that table... if that makes
sense.

netdev lifetime is a bit unusual in how much the rtnl_lock protects.