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=ESmSfh6B; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 0B8E35A0271 for ; Wed, 26 Feb 2025 07:04:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740549864; bh=1g1kCbHq/jo0ec4YMWLyo1e+EmruqQncf6ZY/8v8h4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ESmSfh6BNFrSugRncVVYlrpqFqmhAWDRFhYbBqLwhBSe5spryrvCnY552UtmdVXxJ MjxBgBuRozeUPT2XAsx8lEIdJ7LWSZqYk00SYEZPIdEugYe6EtNQMjNBplPpFuFwzn sw2u1kPSiIx0T+gXMquTXLOUPkrr4D5dgKkyosO3RxHSeS9Adg3Joh73HRydEgLC00 H9gJ7f1MdbzuCDOZxYs67gXmTeenv/rME48YKVD9oL8yeTxMni+e9ESKQDYFxq6MEh fHM9A0j4nNbv8o08ybold1W0g2IG6eeLy//DKzJC2ToT1G0G0X5sbuXxWKhB4QCqVm EtWShiKNInTvg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z2kSm3pQhz4wcj; Wed, 26 Feb 2025 17:04:24 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 1/3] migrate, flow: Trivially succeed if migrating with no flows Date: Wed, 26 Feb 2025 17:04:20 +1100 Message-ID: <20250226060422.48295-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250226060422.48295-1-david@gibson.dropbear.id.au> References: <20250226060422.48295-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: B2CP5GCVSDZBYKOZLTJBGVR35H6UY4BM X-Message-ID-Hash: B2CP5GCVSDZBYKOZLTJBGVR35H6UY4BM 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