lkml.org 
[lkml]   [2021]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next 5/6] devlink: Reshuffle resource registration logic
On Wed, 17 Nov 2021 20:26:21 +0200 Leon Romanovsky wrote:
> - top_hierarchy = parent_resource_id == DEVLINK_RESOURCE_ID_PARENT_TOP;
> -
> - mutex_lock(&devlink->lock);
> - resource = devlink_resource_find(devlink, NULL, resource_id);
> - if (resource) {
> - err = -EINVAL;
> - goto out;
> - }
> + WARN_ON(devlink_resource_find(devlink, NULL, resource_id));

This is not atomic with the add now.

> resource = kzalloc(sizeof(*resource), GFP_KERNEL);
> if (!resource) {
> @@ -9851,7 +9843,17 @@ int devlink_resource_register(struct devlink *devlink,
> goto out;
> }
>
> - if (top_hierarchy) {
> + resource->name = resource_name;
> + resource->size = resource_size;
> + resource->size_new = resource_size;
> + resource->id = resource_id;
> + resource->size_valid = true;
> + memcpy(&resource->size_params, size_params,
> + sizeof(resource->size_params));
> + INIT_LIST_HEAD(&resource->resource_list);
> +
> + mutex_lock(&devlink->lock);

\
 
 \ /
  Last update: 2021-11-18 05:51    [W:0.112 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site