mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
devlink: introduce __devl_is_registered() helper and use it instead of xa_get_mark()
Introduce __devl_is_registered() which does not assert on devlink instance lock and use it in notifications which may be called without devlink instance lock held. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
337ad364c4
commit
11280ddeae
@ -91,10 +91,15 @@ extern struct genl_family devlink_nl_family;
|
||||
|
||||
struct devlink *devlinks_xa_find_get(struct net *net, unsigned long *indexp);
|
||||
|
||||
static inline bool __devl_is_registered(struct devlink *devlink)
|
||||
{
|
||||
return xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED);
|
||||
}
|
||||
|
||||
static inline bool devl_is_registered(struct devlink *devlink)
|
||||
{
|
||||
devl_assert_locked(devlink);
|
||||
return xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED);
|
||||
return __devl_is_registered(devlink);
|
||||
}
|
||||
|
||||
static inline void devl_dev_lock(struct devlink *devlink, bool dev_lock)
|
||||
|
@ -136,7 +136,7 @@ static void devlink_linecard_notify(struct devlink_linecard *linecard,
|
||||
WARN_ON(cmd != DEVLINK_CMD_LINECARD_NEW &&
|
||||
cmd != DEVLINK_CMD_LINECARD_DEL);
|
||||
|
||||
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
|
||||
if (!__devl_is_registered(devlink))
|
||||
return;
|
||||
|
||||
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
|
@ -512,7 +512,7 @@ static void devlink_port_notify(struct devlink_port *devlink_port,
|
||||
|
||||
WARN_ON(cmd != DEVLINK_CMD_PORT_NEW && cmd != DEVLINK_CMD_PORT_DEL);
|
||||
|
||||
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
|
||||
if (!__devl_is_registered(devlink))
|
||||
return;
|
||||
|
||||
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
|
@ -234,7 +234,8 @@ static void devlink_nl_region_notify(struct devlink_region *region,
|
||||
struct sk_buff *msg;
|
||||
|
||||
WARN_ON(cmd != DEVLINK_CMD_REGION_NEW && cmd != DEVLINK_CMD_REGION_DEL);
|
||||
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
|
||||
|
||||
if (!__devl_is_registered(devlink))
|
||||
return;
|
||||
|
||||
msg = devlink_nl_region_notify_build(region, snapshot, cmd, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user