]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not create state file for removed interface
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 25 Feb 2026 15:31:39 +0000 (00:31 +0900)
committerMike Yuan <me@yhndnzj.com>
Thu, 26 Feb 2026 07:50:50 +0000 (08:50 +0100)
Fixes #40817.

src/network/networkd-state-file.c

index 5e485f9895ff2e7446ebb38c3f8cb4d9090e979d..b3b85f18f5c2e68c17dbf277763c172ab4fb3ec7 100644 (file)
@@ -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 */