Skip to content

Commit

Permalink
devlink: document devlink_rel_nested_in_notify() function
Browse files Browse the repository at this point in the history
Add a documentation for devlink_rel_nested_in_notify() describing the
devlink instance locking consequences.

Signed-off-by: Jiri Pirko <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jiri Pirko authored and davem330 committed Oct 18, 2023
1 parent bb11cf9 commit 5d77371
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions net/devlink/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ int devlink_rel_nested_in_add(u32 *rel_index, u32 devlink_index,
return 0;
}

/**
* devlink_rel_nested_in_notify - Notify the object this devlink
* instance is nested in.
* @devlink: devlink
*
* This is called upon network namespace change of devlink instance.
* In case this devlink instance is nested in another devlink object,
* a notification of a change of this object should be sent
* over netlink. The parent devlink instance lock needs to be
* taken during the notification preparation.
* However, since the devlink lock of nested instance is held here,
* we would end with wrong devlink instance lock ordering and
* deadlock. Therefore the work is utilized to avoid that.
*/
void devlink_rel_nested_in_notify(struct devlink *devlink)
{
struct devlink_rel *rel = devlink->rel;
Expand Down

0 comments on commit 5d77371

Please sign in to comment.