From nobody Sun Dec 22 05:40:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1725374337341977.6901254699933; Tue, 3 Sep 2024 07:38:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 410321463; Tue, 3 Sep 2024 10:38:56 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EE18713AB; Tue, 3 Sep 2024 10:36:53 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E2F4FD8F; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 87406121A for ; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-tSF1KWqJPyKjDD4KHSVtvQ-1; Tue, 03 Sep 2024 10:36:35 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42bb68e1706so49978305e9.3 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6df936dsm172780825e9.28.2024.09.03.07.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:32 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 61DEE1FC90BF for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+naiJ2trfEISuYHH58LDgy+P4YyFdOzDUecW4VfSij4=; b=IG83XA5x3n7pyh3Locg5n5UaTYVNAaSZtPq7QY1OJDl3k2PvXClok90k+OwbthI/LgjdaJ T3PnrkS6ueCnrpD970PMWrIIF+7x9/QHnRXA6vjEeDrhjdYaDaWY/XJtzs7u3wtyP/Zlk6 L5RJNSPqGjDixFIfzCfdOKnpdSU+xMk= X-MC-Unique: tSF1KWqJPyKjDD4KHSVtvQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374194; x=1725978994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+naiJ2trfEISuYHH58LDgy+P4YyFdOzDUecW4VfSij4=; b=wPwvHyYQxYtb74MKLfby5UvitAjNtHc8jLjL3Re5wJzBHxFqeZblzDmmNO/n+OIFO9 fZKnQPp2t57xSD/PgNbESHgFcsTwAnm16J3Vuff4AJAi02v1uljsi9a31ytkR/XscS3N EzJhNx7mOfRbkw1x/nTGGfvRCX39O+V7rhNN6MzQjPRVsBHZtrKgyFP8NqkaOecpbcOa Ctbx/0+GhIpueIl34x+H/lnEjw/5i4uuCTMEIW5zEaqhAh+6QbTJs0PXtxMbphXzvwg6 5JWpLUCBB3WuDRx5y4K90QmxyPKTqlpqjpm8nVJm3z4LVdHz063S+8iV/BU9u22tkxqy EWIg== X-Gm-Message-State: AOJu0YytQ3P+mP23+m1fRZ3DWfZ7TAfN3yq/pgZwDcUYXHq/PMRu2Iol daM5rB8X2z+JOh7n/ZXldmmzbrNyhxMK/HkCb32IWDW19NVkpcBZ2DYB75nLCuKF+xwEhgsfEi0 J9QHgN7nR+jK19fZAAR/efBQQRBd3o+liS/WNnFyrmBbbIllH1MbY5E/EQPzUHV+tyFHr8J9oe4 KBiOltkIvO/d8yL3y4JDfJ/6bR7ZZgUFhfNZneHzk= X-Received: by 2002:a05:600c:3c82:b0:42b:b016:94a3 with SMTP id 5b1f17b1804b1-42c88108590mr28688995e9.31.1725374193855; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/O9vLG/DaZDdweql9eKxQYtNgj4fEjuAeFoku3kg1Rvuibmovxu4HSeYE0UkPLFY7NHIjfg== X-Received: by 2002:a05:600c:3c82:b0:42b:b016:94a3 with SMTP id 5b1f17b1804b1-42c88108590mr28688625e9.31.1725374193039; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 7/8] network: Separate cleanup from networkRemoveInactive Date: Tue, 3 Sep 2024 16:36:26 +0200 Message-ID: <989159e664ff666b36feb519a5db6f673c74a30f.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JZPSEKVXGJTQ5NKRZHNBRH4NELFFMKRM X-Message-ID-Hash: JZPSEKVXGJTQ5NKRZHNBRH4NELFFMKRM X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374338427116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The new function (networkCleanupInactive) can be called from an iterator over the list of networks without the risk of deadlock. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 3ef3444da241..0e8057e24aed 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -325,10 +325,10 @@ networkDnsmasqConfigFileName(virNetworkDriverConfig *= cfg, } =20 =20 -/* do needed cleanup steps and remove the network from the list */ +/* do needed cleanup steps */ static int -networkRemoveInactive(virNetworkDriverState *driver, - virNetworkObj *obj) +networkCleanupInactive(virNetworkDriverState *driver, + virNetworkObj *obj) { g_autoptr(virNetworkDriverConfig) cfg =3D virNetworkDriverGetConfig(dr= iver); g_autofree char *leasefile =3D NULL; @@ -372,6 +372,18 @@ networkRemoveInactive(virNetworkDriverState *driver, /* remove status file */ unlink(statusfile); =20 + return 0; +} + + +/* do needed cleanup steps and remove the network from the list */ +static int +networkRemoveInactive(virNetworkDriverState *driver, + virNetworkObj *obj) +{ + if (networkCleanupInactive(driver, obj) < 0) + return -1; + /* remove the network definition */ virNetworkObjRemoveInactive(driver->networks, obj); =20 --=20 2.46.0