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=NbngT71I; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id D36275A0272 for ; Thu, 27 Feb 2025 06:55:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740635720; bh=1g1kCbHq/jo0ec4YMWLyo1e+EmruqQncf6ZY/8v8h4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NbngT71IIbr8XUvp4UMZWN3TJH+qrAWOXy0sht7jllp5KNtBERhD7wza7hwk/wDWp ec3WdMmanzYI05/pIZdxfxoG6qE+Zh9RkxvtelWeVI0r4NqQ4Rc5AYYCRl5ZtKneFu 3IgLqptORBkBWJuaFEDc9h1NSpcWtsvLVaRdg0N+NJ5VNXzFP27B1CxN/wNLnDpDYG rzFk96D2LW2UKDvj+wad4BqZsguCv+WCelVQjhseuCpFnboJFrPsuIYTqZIge9zOv1 65gCILmAuR6DN8AeWQ14zYCsrHst84uSaf2JccLUj46BOi+l4OMRBa4S9Mzup5SoBb IIqIuwX6bZk6Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z3LCr0JXBz4x2c; Thu, 27 Feb 2025 16:55:20 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v4 1/5] migrate, flow: Trivially succeed if migrating with no flows Date: Thu, 27 Feb 2025 16:55:13 +1100 Message-ID: <20250227055517.497347-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250227055517.497347-1-david@gibson.dropbear.id.au> References: <20250227055517.497347-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: UW66WUDJAKGB2K762LNYHJHFJHWKFEC2 X-Message-ID-Hash: UW66WUDJAKGB2K762LNYHJHFJHWKFEC2 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