From 2900f04c82b09d64a36e6b0c3f0d2195cf6f1264 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 26 Feb 2026 00:31:39 +0900 Subject: [PATCH] network: do not create state file for removed interface Fixes #40817. --- src/network/networkd-state-file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/networkd-state-file.c b/src/network/networkd-state-file.c index 5e485f9895..b3b85f18f5 100644 --- a/src/network/networkd-state-file.c +++ b/src/network/networkd-state-file.c @@ -999,6 +999,12 @@ void link_dirty(Link *link) { /* Also mark manager dirty as link is dirty */ link->manager->dirty = true; + /* The interface has been already removed, and the state file for the interface has been or will be + * removed. The file should not be recreated. Note, even in that case, we may need to recreate the + * manager state file. Hence the dirty flag for the manager should be set in the above. */ + if (link->state == LINK_STATE_LINGER) + return; + if (set_ensure_put(&link->manager->dirty_links, &link_hash_ops, link) <= 0) return; /* Ignore allocation errors and don't take another ref if the link was already dirty */