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=elPNLbD8; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id E4DF75A061A for ; Thu, 20 Feb 2025 07:04:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740031446; bh=1g1kCbHq/jo0ec4YMWLyo1e+EmruqQncf6ZY/8v8h4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elPNLbD8CBTH7QyUG3zgB0+A2dVP2Wi9q3WVbih5alGYHELXf/76mIR0n6npkwxSz gwnytfu0y1L+Uajz3wD7/0bLRHTtsnKJlyGzlVDNhmg0BRudPjgwCIFJd/MRqsbvFF eRm7lW29+fTrYpfaA1SBERf3tEpDmbT3lLNfTcpuuh8vW+VFLPtbZtXUH+julDr152 7rpX7u7EbX9N2GSeTmctDQNC0E5gCeJrEOl+unSm6q2MgJRVwmA0+TNUWI3g4iQXIB 8t6IYr2eErC8afBSWlnf8UpG5rSrzq8JXBrmG+og8V6tZA83nWL7VMgXGcXRGwKhTL A94t8q5/jvVUg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yz2lB0YZjz4wj2; Thu, 20 Feb 2025 17:04:06 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 1/2] migrate, flow: Trivially succeed if migrating with no flows Date: Thu, 20 Feb 2025 17:03:17 +1100 Message-ID: <20250220060318.1796504-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250220060318.1796504-1-david@gibson.dropbear.id.au> References: <20250220060318.1796504-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: C6TL5VDBWAYGCU5M4CR4AFIFC3HM7H3L X-Message-ID-Hash: C6TL5VDBWAYGCU5M4CR4AFIFC3HM7H3L 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