Skip to content

Commit 437ebfd

Browse files
rleondavem330
authored andcommitted
devlink: Count struct devlink consumers
The struct devlink itself is protected by internal lock and doesn't need global lock during operation. That global lock is used to protect addition/removal new devlink instances from the global list in use by all devlink consumers in the system. The future conversion of linked list to be xarray will allow us to actually delete that lock, but first we need to count all struct devlink users. The reference counting provides us a way to ensure that no new user space commands success to grab devlink instance which is going to be destroyed makes it is safe to access it without lock. Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7ca973d commit 437ebfd

File tree

2 files changed

+172
-35
lines changed

2 files changed

+172
-35
lines changed

include/net/devlink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ struct devlink {
5656
*/
5757
u8 reload_failed:1,
5858
reload_enabled:1;
59+
refcount_t refcount;
60+
struct completion comp;
5961
char priv[0] __aligned(NETDEV_ALIGN);
6062
};
6163

0 commit comments

Comments
 (0)