Skip to content

Commit 7effaf0

Browse files
Tariq Toukandavem330
authored andcommitted
net: rollback orig value on failure of dev_qdisc_change_tx_queue_len
Fix dev_change_tx_queue_len so it rolls back original value upon a failure in dev_qdisc_change_tx_queue_len. This is already done for notifirers' failures, share the code. In case of failure in dev_qdisc_change_tx_queue_len, some tx queues would still be of the new length, while they should be reverted. Currently, the revert is not done, and is marked with a TODO label in dev_qdisc_change_tx_queue_len, and should find some nice solution to do it. Yet it is still better to not apply the newly requested value. Fixes: 48bfd55 ("net_sched: plug in qdisc ops change_tx_queue_len") Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Eran Ben Elisha <[email protected]> Reported-by: Ran Rozenstein <[email protected]> Cc: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7f3fc7d commit 7effaf0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

net/core/dev.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7149,16 +7149,19 @@ int dev_change_tx_queue_len(struct net_device *dev, unsigned long new_len)
71497149
dev->tx_queue_len = new_len;
71507150
res = call_netdevice_notifiers(NETDEV_CHANGE_TX_QUEUE_LEN, dev);
71517151
res = notifier_to_errno(res);
7152-
if (res) {
7153-
netdev_err(dev,
7154-
"refused to change device tx_queue_len\n");
7155-
dev->tx_queue_len = orig_len;
7156-
return res;
7157-
}
7158-
return dev_qdisc_change_tx_queue_len(dev);
7152+
if (res)
7153+
goto err_rollback;
7154+
res = dev_qdisc_change_tx_queue_len(dev);
7155+
if (res)
7156+
goto err_rollback;
71597157
}
71607158

71617159
return 0;
7160+
7161+
err_rollback:
7162+
netdev_err(dev, "refused to change device tx_queue_len\n");
7163+
dev->tx_queue_len = orig_len;
7164+
return res;
71627165
}
71637166

71647167
/**

0 commit comments

Comments
 (0)