]> git.ipfire.org Git - thirdparty/iproute2.git/commit
devlink: Fix dumps where interface map is used
authorIdo Schimmel <idosch@nvidia.com>
Thu, 27 Apr 2023 05:25:21 +0000 (08:25 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 27 Apr 2023 15:53:27 +0000 (08:53 -0700)
commitb6f4a62ba7a07c546d71c14a94be1c4481a65b1a
treeda0eaf19240ba67c4332937c3abcf5289580313e
parentb54a4c9fc0cb9d382b1d4e479a43fd7675804c20
devlink: Fix dumps where interface map is used

The devlink utility stores an interface map that can be used to map an
interface name to a devlink port and vice versa. The map is populated by
issuing a devlink port dump via 'DEVLINK_CMD_PORT_GET' command.

Cited commits started to populate the map only when it is actually
needed. One such case is when a dump (e.g., shared buffer dump) only
returns devlink port handles. When pretty printing is required, the
utility will consult the map to translate the devlink port handles to
the corresponding interface names.

The above is problematic as it means that the port dump response(s) will
be queued to the same receive buffer as the response(s) of the dump that
triggered the port dump, resulting in a failed dump [1].

Fix by using a different netlink socket for the population of the
interface map.

[1]
$ devlink sb tc bind show
kernel answers: Device or resource busy
Failed to create index map
//0:
  sb 0 tc 4 type egress pool 4 threshold 9
kernel answers: Device or resource busy
[...]
$ echo $?
1

Fixes: 5cddbb274eab ("devlink: load port-ifname map on demand")
Fixes: 63d84b1fc98d ("devlink: load ifname map on demand from ifname_map_rev_lookup() as well")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
devlink/devlink.c