devlink: hold the instance lock during eswitch_mode callbacks
Make the devlink core hold the instance lock during eswitch_mode callbacks. Cheat in case of mlx5 (see the cover letter). Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
aff3a92509
commit
14e426bf1a
@@ -2868,15 +2868,11 @@ static int devlink_rate_nodes_check(struct devlink *devlink, u16 mode,
|
||||
{
|
||||
struct devlink_rate *devlink_rate;
|
||||
|
||||
/* Take the lock to sync with destroy */
|
||||
mutex_lock(&devlink->lock);
|
||||
list_for_each_entry(devlink_rate, &devlink->rate_list, list)
|
||||
if (devlink_rate_is_node(devlink_rate)) {
|
||||
mutex_unlock(&devlink->lock);
|
||||
NL_SET_ERR_MSG_MOD(extack, "Rate node(s) exists.");
|
||||
return -EBUSY;
|
||||
}
|
||||
mutex_unlock(&devlink->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8735,14 +8731,12 @@ static const struct genl_small_ops devlink_nl_ops[] = {
|
||||
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
|
||||
.doit = devlink_nl_cmd_eswitch_get_doit,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
.internal_flags = DEVLINK_NL_FLAG_NO_LOCK,
|
||||
},
|
||||
{
|
||||
.cmd = DEVLINK_CMD_ESWITCH_SET,
|
||||
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
|
||||
.doit = devlink_nl_cmd_eswitch_set_doit,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
.internal_flags = DEVLINK_NL_FLAG_NO_LOCK,
|
||||
},
|
||||
{
|
||||
.cmd = DEVLINK_CMD_DPIPE_TABLE_GET,
|
||||
|
||||
Reference in New Issue
Block a user