Skip to content

Commit 82274d0

Browse files
kuba-moodavem330
authored andcommitted
devlink: ignore -EOPNOTSUPP errors on dumpit
Number of .dumpit functions try to ignore -EOPNOTSUPP errors. Recent change missed that, and started reporting all errors but -EMSGSIZE back from dumps. This leads to situation like this: $ devlink dev info devlink answers: Operation not supported Dump should not report an error just because the last device to be queried could not provide an answer. To fix this and avoid similar confusion make sure we clear err properly, and not leave it set to an error if we don't terminate the iteration. Fixes: c62c2cf ("net: devlink: don't ignore errors during dumpit") Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6555009 commit 82274d0

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

net/core/devlink.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,9 @@ static int devlink_nl_cmd_sb_pool_get_dumpit(struct sk_buff *msg,
10651065
devlink_sb,
10661066
NETLINK_CB(cb->skb).portid,
10671067
cb->nlh->nlmsg_seq);
1068-
if (err && err != -EOPNOTSUPP) {
1068+
if (err == -EOPNOTSUPP) {
1069+
err = 0;
1070+
} else if (err) {
10691071
mutex_unlock(&devlink->lock);
10701072
goto out;
10711073
}
@@ -1266,7 +1268,9 @@ static int devlink_nl_cmd_sb_port_pool_get_dumpit(struct sk_buff *msg,
12661268
devlink, devlink_sb,
12671269
NETLINK_CB(cb->skb).portid,
12681270
cb->nlh->nlmsg_seq);
1269-
if (err && err != -EOPNOTSUPP) {
1271+
if (err == -EOPNOTSUPP) {
1272+
err = 0;
1273+
} else if (err) {
12701274
mutex_unlock(&devlink->lock);
12711275
goto out;
12721276
}
@@ -1498,7 +1502,9 @@ devlink_nl_cmd_sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
14981502
devlink_sb,
14991503
NETLINK_CB(cb->skb).portid,
15001504
cb->nlh->nlmsg_seq);
1501-
if (err && err != -EOPNOTSUPP) {
1505+
if (err == -EOPNOTSUPP) {
1506+
err = 0;
1507+
} else if (err) {
15021508
mutex_unlock(&devlink->lock);
15031509
goto out;
15041510
}
@@ -3299,7 +3305,9 @@ static int devlink_nl_cmd_param_get_dumpit(struct sk_buff *msg,
32993305
NETLINK_CB(cb->skb).portid,
33003306
cb->nlh->nlmsg_seq,
33013307
NLM_F_MULTI);
3302-
if (err && err != -EOPNOTSUPP) {
3308+
if (err == -EOPNOTSUPP) {
3309+
err = 0;
3310+
} else if (err) {
33033311
mutex_unlock(&devlink->lock);
33043312
goto out;
33053313
}
@@ -3569,7 +3577,9 @@ static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg,
35693577
NETLINK_CB(cb->skb).portid,
35703578
cb->nlh->nlmsg_seq,
35713579
NLM_F_MULTI);
3572-
if (err && err != -EOPNOTSUPP) {
3580+
if (err == -EOPNOTSUPP) {
3581+
err = 0;
3582+
} else if (err) {
35733583
mutex_unlock(&devlink->lock);
35743584
goto out;
35753585
}
@@ -4518,7 +4528,9 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
45184528
cb->nlh->nlmsg_seq, NLM_F_MULTI,
45194529
cb->extack);
45204530
mutex_unlock(&devlink->lock);
4521-
if (err && err != -EOPNOTSUPP)
4531+
if (err == -EOPNOTSUPP)
4532+
err = 0;
4533+
else if (err)
45224534
break;
45234535
idx++;
45244536
}

0 commit comments

Comments
 (0)