diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-02-08 04:47:39 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-02-09 06:25:54 +0100 |
commit | 1e869a5de9063dfe6afac52bffc7c9c2d206b096 (patch) | |
tree | 3e206680a445bc8f09dc99627655ef1ce60efa84 /src/network/networkd-manager-bus.c | |
parent | Merge pull request #31177 from yuwata/network-ndisc-on-link-zero (diff) | |
download | systemd-1e869a5de9063dfe6afac52bffc7c9c2d206b096.tar.xz systemd-1e869a5de9063dfe6afac52bffc7c9c2d206b096.zip |
network: make Reload bus method synchronous
Prompted by https://github.com/systemd/systemd/pull/30085#discussion_r1401534107.
Note, like Reconfigure bus method, even reconfiguration for an interface is
triggered by Reload method, the method only wait for the link enters
configuring state (or unmanaged state if no matching .network file exists).
Users still need to invoke systemd-networkd-wait-online if it is
necessary to wait for the interface enters configured state after Reload
medhod.
Diffstat (limited to 'src/network/networkd-manager-bus.c')
-rw-r--r-- | src/network/networkd-manager-bus.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/network/networkd-manager-bus.c b/src/network/networkd-manager-bus.c index 035537c869..3c3d815a4a 100644 --- a/src/network/networkd-manager-bus.c +++ b/src/network/networkd-manager-bus.c @@ -198,9 +198,12 @@ static int bus_method_reconfigure_link(sd_bus_message *message, void *userdata, } static int bus_method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) { - Manager *manager = userdata; + Manager *manager = ASSERT_PTR(userdata); int r; + if (manager->reloading > 0) + return sd_bus_error_set(error, BUS_ERROR_NETWORK_ALREADY_RELOADING, "Already reloading."); + r = bus_verify_polkit_async( message, "org.freedesktop.network1.reload", @@ -212,10 +215,13 @@ static int bus_method_reload(sd_bus_message *message, void *userdata, sd_bus_err if (r == 0) return 1; /* Polkit will call us back */ - r = manager_reload(manager); + r = manager_reload(manager, message); if (r < 0) return r; + if (manager->reloading > 0) + return 1; /* Will reply later. */ + return sd_bus_reply_method_return(message, NULL); } |