mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 10:13:34 +08:00
network/netdev: fix counter handling if request is cancelled
Follow-up for 1003093604
.
If a netdev is detached for some reasons, then previously the request
was simply cancelled, and the underlying interface never enter the
configured state, as the 'stacked_netdevs_created' flag never set.
This makes the counter decremented manually by the function, and set the
flag. So, the underlying interface can eter the configured state.
This commit is contained in:
parent
259125d53d
commit
f264cd2037
@ -854,7 +854,7 @@ static int stacked_netdev_process_request(Request *req, Link *link, void *userda
|
||||
assert(link);
|
||||
|
||||
if (!netdev_is_managed(netdev))
|
||||
return 1; /* Already detached, due to e.g. reloading .netdev files, cancelling the request. */
|
||||
goto cancelled; /* Already detached, due to e.g. reloading .netdev files, cancelling the request. */
|
||||
|
||||
r = netdev_is_ready_to_create(netdev, link);
|
||||
if (r <= 0)
|
||||
@ -865,6 +865,18 @@ static int stacked_netdev_process_request(Request *req, Link *link, void *userda
|
||||
return log_netdev_warning_errno(netdev, r, "Failed to create netdev: %m");
|
||||
|
||||
return 1;
|
||||
|
||||
cancelled:
|
||||
assert_se(TAKE_PTR(req->counter) == &link->create_stacked_netdev_messages);
|
||||
link->create_stacked_netdev_messages--;
|
||||
|
||||
if (link->create_stacked_netdev_messages == 0) {
|
||||
link->stacked_netdevs_created = true;
|
||||
log_link_debug(link, "Stacked netdevs created.");
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int create_stacked_netdev_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, void *userdata) {
|
||||
|
Loading…
Reference in New Issue
Block a user