From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11023110.outbound.protection.outlook.com [52.101.72.110]) by lore.virtuozzo.com (Postfix) with ESMTPS id 5017B8002A for ; Wed, 25 Nov 2026 19:32:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B7IaYn5wF8vmxHszFWJwI6YqDIRYU6DmOrXAIdhDc5w56hiQGFZyGZPhP20fb1765Wkmx4DfiFVE3gFIWOHWfZOWD19XxNco58vCdoK3NXPC/0SoCvlGf+gxr33tE1Ou8y1dhjDHUBF2c3bTvMIfV6m9GuGsvLW6DCEafje6x/wzfY9v18Psl9wulqQl77e7Y+utMhbPOkJo99W5pAVOVLeEskReJAR6yhabkMQfXoNq0ad3btczIAIP02niJUScNh8kJ9/DGJx8SwP6L4nE90BIBTv5BeiNURsefKMoEsDVhWDQK7VESV4wlOsTTxTAdn1DtQqcKNk8UEEJlGNH2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Tr9wfM9j66q1RCOkjwtPkdO7KVjK5LPm8ejgph4V7Mc=; b=skMIrptaoPRyHZCKRC+5pzE0sCzr1DvThTT2k9gcu7C2LO/tGEbvMbHLnlbV0nzINsEMFFpSyn40qfaVu4Y7daiS2JlZ8RCfgubYl7DJ6uLqimGOoU8rk+Krcg+8KrJPQQu2wjfiiOrUGkBpu/2QZ4R3ep0lyGYTzOqums1TyQQwFgvOCC4caQBMghC3+2v+JrqCbDRPtzrZG6ikshqxcFxkuQ/1KZgpVt9hqY12uszH18vrslWpLpzVU1Djb7V7BYpGeV2hwkqnqDcHWchMdNb4xOUQB9tXjDM1+1jff24FjunD30KsjCulFMzhIwiy99r/BFaXz0ssT5oGsyPv4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 2a00:1450:4864:20::42c) smtp.rcpttodomain=virtuozzo.com smtp.mailfrom=openvz.org; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=openvz.org; dkim=pass (signature was verified) header.d=openvz.org; arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.onmicrosoft.com; s=selector2-virtuozzo-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Tr9wfM9j66q1RCOkjwtPkdO7KVjK5LPm8ejgph4V7Mc=; b=YErYaD6tYamfMvZqj5ivdnQYTcBNU3yh40hWJ18SvUhTnvnPIb/wgv0PCK5Rv06PX0WcOUNLWVllsq9EBey3d7R5cLJv9TWg3eI3hXQD/r9qHL4PjiE4J2qTzAOrAeTU3DYcITddmkWkRVrHSQCM0d2+06ieSCvT5kdUjtSHTbQ= Received: from VIVP296CA0034.AUTP296.PROD.OUTLOOK.COM (2603:10a6:800:356::10) by PAWPR08MB9688.eurprd08.prod.outlook.com (2603:10a6:102:2ea::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.6; Wed, 25 Nov 2026 19:32:10 +0000 Received: from MI3PEPF00008491.eurprd03.prod.outlook.com (2603:10a6:800:356:cafe::42) by VIVP296CA0034.outlook.office365.com (2603:10a6:800:356::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.7 via Frontend Transport; Wed, 25 Nov 2026 19:32:10 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 2a00:1450:4864:20::42c) smtp.mailfrom=openvz.org; dkim=pass (signature was verified) header.d=openvz.org;dmarc=pass action=none header.from=openvz.org; Received-SPF: Pass (protection.outlook.com: domain of openvz.org designates 2a00:1450:4864:20::42c as permitted sender) receiver=protection.outlook.com; client-ip=2a00:1450:4864:20::42c; helo=mail-wr1-x42c.google.com; pr=C Received: from mail-wr1-x42c.google.com (2a00:1450:4864:20::42c) by MI3PEPF00008491.mail.protection.outlook.com (2603:10a6:298:1::58) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.3 via Frontend Transport; Wed, 25 Nov 2026 19:32:10 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-49412eb1474so4016602f8f.3 for ; Wed, 25 Nov 2026 11:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1795635130; x=1796239930; darn=virtuozzo.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Tr9wfM9j66q1RCOkjwtPkdO7KVjK5LPm8ejgph4V7Mc=; b=W7AA6gjS+PbD3T7w410xfd7YTffhWXCZYhzOukFR/Y3rpOTXfvRwWodFGHVLpdw/+j QmHsUlYUssClT71SsDTVbHzLVyOw+DprlRxwk8pbDqUxXb9HVbmv/Xnw8CENSykaCx1K udnxmBNmJ3IdCumWPiCcO3fnv5v5AHwligWer/VrTWzTA9Kpxw8IBM3om7UtsRd9XGw2 U3ivQNTz4t6VtF7SCs89T8auvjlhBRhSHiQh/0xabsP01Fo5jjAfu4CJWTxEMH9J/IWQ CXrejFUyswoLZ3sktWcbFT80j/1uo2MXVsNbWqnh9PrlcftseQKuI7y7gZNESMt3hv74 TLMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795635130; x=1796239930; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Tr9wfM9j66q1RCOkjwtPkdO7KVjK5LPm8ejgph4V7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0GbSQoVJc8vvFXNwp1tvn+l4n0U/WJ5w MDn5mJauZvfq4dsZ2KUXR7vdJ2M= X-Received: by 2002:a5d:64c4:0:b0:48e:7b12:ac9f with SMTP id ffacd0b85a97d-4abb5fa17f2mr37153777f8f.40.1795635129737; Wed, 25 Nov 2026 11:32:09 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:73c7:7c5f:a985:743e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a67f1b2sm33344055f8f.25.2026.11.25.11.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 11:32:09 -0800 (PST) From: "Denis V. Lunev" To: svt-core@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org Subject: [PATCH hci-8.1 2/2] tests/qtest/migration: test cancel before the channel connects #VSTOR-155277 Date: Wed, 25 Nov 2026 20:32:04 +0100 Message-ID: <20261125193204.1424799-3-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261125193204.1424799-1-den@openvz.org> References: <20261125193204.1424799-1-den@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF00008491:EE_|PAWPR08MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 9809f85f-0058-4073-bf33-08df4b2accab X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|704161411799003|9140799003|48200799018|376014|6059299003|43022699015|61400799027|82310400026|55112099003|10067099003|56012099006|5063699009|261022075727099003|261022105027099003|261021121427099003|261009223027099003|261026140227099003|261028144727099003|261102123227099003|16102099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mV+FeORJgqa+7xvMCZEvRX6iPdPlygYVKZwhy6BGldrVNGZqPKOZDoIFyTwE?= =?us-ascii?Q?8p1aTsOOtTzxaOtxBdaOtQTlaWl6xcplEs85Fb5iq773Pa6SxE257I1RpaBi?= =?us-ascii?Q?m1r9Vp5PJIUdXsyW0xiFiBSDb7CI2CApzzQFK3a5C00nmX6xV0hPG6xPe5Os?= =?us-ascii?Q?eKA2kKIWaisRAY08J5b2yoyL8c9G1baPELFitkL0Yi4X+fh0QbYKmMSh+pOb?= =?us-ascii?Q?L0pHu+B6eA85dK+StFi3sqeBKp3lHgVi2thn3XKSwTnOqY92n6DvHllJFctA?= =?us-ascii?Q?02imq/MxmtGRCpXfiJwVWk3P4wcU0pr1yPuAr9kAmZLt8hrAIUPP5cxyQheW?= =?us-ascii?Q?4Ft2ftUaAZUiYRn8t3lkVDxp/OfMiKOEwGhoklcsLMcyNDeKm/sIPGilRiCe?= =?us-ascii?Q?qM6jYSQdLIRaNIpn1/vuoTiWEKBMfnqOB9emtJM3xM35YTHbdLwRI+BAiYHT?= =?us-ascii?Q?zLaZAqI2PrqaQuG3fUUySsGNBS8MC76gA/V894xo83sxa1LzBTpBHItwVBwr?= =?us-ascii?Q?RYxCB2Z6HU411SdUmupzKptNMZUDfEBHW9fXD5GPuxYUOrLJsWiRwY/6njbh?= =?us-ascii?Q?a6iSTZXY+l96gTVZP+/P/YghUFGK4grGprSj6sXSacuXo6ws4GQI/GK3ZZG0?= =?us-ascii?Q?Z/jpQcs8csm2jgpHP8Z7rBX1pU5WgMlble8wMeawdFZTmRIxCJwftwa9cSQg?= =?us-ascii?Q?nHBBEnbuOEhqO1OqaD+bje4z1ZLZN5ZSAwPwTa6l+EgSDg0y3movLScZW1au?= =?us-ascii?Q?HWLJSSRzGJJTN19yQNqFjsjLlTpdpuAazAu74dlfIKdEHxH+a/IC0LmM9ucJ?= =?us-ascii?Q?1PM3HtMhx67dCSJNg5+ZEdPK/3s3AoTFlTm7AAP/0Y2lVjKlUw5bjSgHb4ME?= =?us-ascii?Q?PCVK0/3pbjyuwIJYPpIxsJ8hRm9ybTUw6xaayssXvKiKDIWxRVfq/ZkdHfkQ?= =?us-ascii?Q?88XbSg5QB6xQy/nwivOWD3vxlu03jbucbcL9WxOTaODaX9DS7jFLZb66glhI?= =?us-ascii?Q?GsJagelCW5XwyfsIeRddndtI7Q=3D=3D?= X-Forefront-Antispam-Report: CIP:2a00:1450:4864:20::42c;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail-wr1-x42c.google.com;PTR:mail-wr1-x42c.google.com;CAT:NONE;SFS:(13230040)(704161411799003)(9140799003)(48200799018)(376014)(6059299003)(43022699015)(61400799027)(82310400026)(55112099003)(10067099003)(56012099006)(5063699009)(261022075727099003)(261022105027099003)(261021121427099003)(261009223027099003)(261026140227099003)(261028144727099003)(261102123227099003)(16102099003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QrDLBNqoCEHQL58OdjRncGn1NRWd6F+kKepQCiYw0NIigAQ8Cwdc6ijV+y8hez4bGRGmHf4JGrZJ+bfX3+F1cEyez0eYcsbYQRxQhI2/r06bWMfPmGdFmz2DA1R0SHuVwL0TA0Kd1yW+qIvwSXPkLRfL9JvazSuPH28RV8915z8Y4dT6T30zkQn+4MnK8eup3tW9qE3BPGuOq+8EpTr2RkFADk6VMsvcZTr1NC1YP5gMPb8pCdihDffbLbZMUuaz5A/wXPjzA/8+YYNofVge30/fRHQiG81L264OljQlauJY3CQSARIp3cLtfhJfGE2M4vLoKSYyFJX9O10mIRX5vPHBbyQJujO2XgL1sSrYVpsW34lPusXobLZIN/oEesv8YDMj04pN7wNp8iZa2XPEavI94QaAHXYL8deEmHdkZ12Boz3BCARNK6z+Aqdik/Z8 X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2026 19:32:10.3571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9809f85f-0058-4073-bf33-08df4b2accab X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF00008491.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9688 List-Id: From: Denis V. Lunev Cancel a migration while the source is still connecting, then let the connection succeed. The source must end up in "cancelled", and a second migration afterwards must complete. To keep the source waiting in connect(), the test points it at a unix socket of its own whose listen queue is already full. On Linux, connect() then blocks until the test accepts a connection, so the test is Linux-only. The return-path capability is on because the hang this test guards against is the cleanup waiting for the return path thread. Signed-off-by: Denis V. Lunev Cc: Peter Xu Cc: Fabiano Rosas Cc: Laurent Vivier --- tests/qtest/migration/precopy-tests.c | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c index bb38292550c..2b0afdbd48d 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -821,6 +821,69 @@ static void test_cancel_src_after_status(void *opaque) migrate_end(from, to, false); } +#ifdef CONFIG_LINUX +/* On Linux connect() to a unix socket with a full backlog blocks */ +static int unix_listen_full(const char *path, int *filler) +{ + struct sockaddr_un addr = { .sun_family = AF_UNIX }; + int lfd = socket(AF_UNIX, SOCK_STREAM, 0); + + *filler = socket(AF_UNIX, SOCK_STREAM, 0); + g_assert_cmpint(lfd, >=, 0); + g_assert_cmpint(*filler, >=, 0); + + g_assert_cmpuint(strlen(path), <, sizeof(addr.sun_path)); + strcpy(addr.sun_path, path); + g_assert_cmpint(bind(lfd, (struct sockaddr *)&addr, sizeof(addr)), ==, 0); + g_assert_cmpint(listen(lfd, 0), ==, 0); + g_assert_cmpint(connect(*filler, (struct sockaddr *)&addr, sizeof(addr)), + ==, 0); + return lfd; +} + +static void test_cancel_src_before_connect(void) +{ + g_autofree char *full_path = g_strdup_printf("%s/migsocket-full", tmpfs); + g_autofree char *full_uri = g_strdup_printf("unix:%s", full_path); + g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); + QTestState *from, *to; + MigrateStart args = {}; + int lfd, filler, accepted; + + if (migrate_start(&from, &to, "defer", &args)) { + return; + } + + migrate_set_capability(from, "return-path", true); + migrate_set_capability(to, "return-path", true); + + lfd = unix_listen_full(full_path, &filler); + migrate_qmp(from, to, full_uri, NULL, "{}"); + migrate_cancel(from); + + /* Taking the filler off the backlog lets the source's connect() finish */ + accepted = accept(lfd, NULL, NULL); + g_assert_cmpint(accepted, >=, 0); + + wait_for_migration_status(from, "cancelled", + (const char * []) { "completed", NULL }); + + close(accepted); + close(filler); + close(lfd); + unlink(full_path); + + migrate_incoming_qmp(to, uri, NULL, "{}"); + wait_for_serial("src_serial"); + migrate_ensure_converge(from); + migrate_qmp(from, to, uri, NULL, "{}"); + wait_for_migration_complete(from); + wait_for_migration_complete(to); + + migrate_end(from, to, true); +} +#endif + static void calc_dirty_rate(QTestState *who, uint64_t calc_time) { qtest_qmp_assert_success(who, @@ -1334,4 +1397,8 @@ void migration_test_add_precopy(MigrationTestEnv *env) test_cancel_src_after_status); } } +#ifdef CONFIG_LINUX + migration_test_add("/migration/cancel/src/before/connect", + test_cancel_src_before_connect); +#endif } -- 2.55.0