On 6/8/26 11:39 PM, Tariq Toukan wrote:
> @@ -9010,13 +9029,29 @@ static int cmd_resource_show(struct dl *dl)
> uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
> struct nlmsghdr *nlh;
> struct resource_ctx resource_ctx = {};
> + struct dl_opts *opts = &dl->opts;
> int err;
>
> - err = dl_argv_parse_with_selector(dl, &flags, DEVLINK_CMD_RESOURCE_DUMP,
> - DL_OPT_HANDLE | DL_OPT_HANDLEP,
> - 0, 0, 0);
> - if (err)
> - return err;
> + if (dl_argv_match(dl, "scope")) {
> + const char *scopestr;
> +
> + dl_arg_inc(dl);
> + err = dl_argv_str(dl, &scopestr);
> + if (err)
> + return err;
> + err = resource_scope_get(scopestr, &opts->resource_scope_mask);
> + if (err)
> + return err;
> + opts->present |= DL_OPT_RESOURCE_SCOPE;
Comment from Claude that seems legit:
Issue found: In cmd_resource_show, the scope path sets opts->present |=
DL_OPT_RESOURCE_SCOPE without first clearing opts->present. In batch
mode, dl->opts is shared across commands, and the non-scope path
correctly resets opts->present via dl_argv_parse(). But the scope path
bypasses dl_argv_parse(), so stale bits (e.g. DL_OPT_HANDLE from a
previous dev show) remain. When dl_opts_put() runs, it writes the stale
DEVLINK_ATTR_BUS_NAME/DEV_NAME attributes into the dump request,
silently filtering to a single device instead of all devices. Fix: use =
instead of |=
Are you ok with the suggested resolution?