From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=IJ2sVE1x; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 594975A061E for ; Tue, 25 Feb 2025 06:51:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740462693; bh=1g1kCbHq/jo0ec4YMWLyo1e+EmruqQncf6ZY/8v8h4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJ2sVE1xxif5XwAn8N5qMbvg+YKzOul213aSPGMFoEiPPT9Tvut5oKW2cU/CAa4xY iGJpv9E53bpHe8dg48ZmV8wSX/6XGFuGl1hkgJMq4DiXqiVHWt86FKr5bIcxxuxlcA 6KQHDoRvtDOfqTlcDVvuiuc49uX4AB4k++IKjwHfREMVuNgV8GEXrZCI53LW2Sa1TL DCT662MCccS7IrK6bNqqzg9iAVC2zIF4DJZlR5KSaEARyLAzpg24N6n+c+opmYOgCx 4aiKSYGIciVlAUZolAUVwFrFbsKNpizUrsmTCQE3qZx7H/XaqU8dDgfp54ofBNKZ8Q ky970WoVLKMEg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z26DP5t5yz4whq; Tue, 25 Feb 2025 16:51:33 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 1/2] migrate, flow: Trivially succeed if migrating with no flows Date: Tue, 25 Feb 2025 16:51:31 +1100 Message-ID: <20250225055132.3677190-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250225055132.3677190-1-david@gibson.dropbear.id.au> References: <20250225055132.3677190-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: WODMBRY6AKIBMTJKRPI5BAOZCJO3DRDZ X-Message-ID-Hash: WODMBRY6AKIBMTJKRPI5BAOZCJO3DRDZ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: We could get a migration request when we have no active flows; or at least none that we need or are able to migrate. In this case after sending or receiving the number of flows we continue to step through various lists. In the target case, this could include communication with passt-repair. If passt-repair wasn't started that could cause further errors, but of course they shouldn't matter if we have nothing to repair. Make it more obvious that there's nothing to do and avoid such errors by short-circuiting flow_migrate_{source,target}() if there are no migratable flows. Signed-off-by: David Gibson --- flow.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flow.c b/flow.c index bb5dcc3c..6cf96c26 100644 --- a/flow.c +++ b/flow.c @@ -999,6 +999,9 @@ int flow_migrate_source(struct ctx *c, const struct migrate_stage *stage, debug("Sending %u flows", ntohl(count)); + if (!count) + return 0; + /* Dump and send information that can be stored in the flow table. * * Limited rollback options here: if we fail to transfer any data (that @@ -1070,6 +1073,9 @@ int flow_migrate_target(struct ctx *c, const struct migrate_stage *stage, count = ntohl(count); debug("Receiving %u flows", count); + if (!count) + return 0; + if ((rc = flow_migrate_repair_all(c, true))) return -rc; -- 2.48.1