From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11023094.outbound.protection.outlook.com [52.101.72.94]) by lore.virtuozzo.com (Postfix) with ESMTPS id 63FFA802A7 for ; Mon, 5 Oct 2026 09:30:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IkTTa/cGcLZRCOa+r0jS9DQEla/IJ26Dnbt7baA3tyxjwfQszBqxniXMnxrlh+bePyzQoQjpQyzQfrdX2UJez36DrNAK5LmTQ05J2TIZeEdjqHij+lBqvvrbaVCqaDaS/uajk2lu4bYQuzGZvT+w3LGzfcg4sg5NOueP2Z3E2PpQAK6t1igdFh9wuNkXSY7KjhVyAi2U6TOvgfEA6GCQFulBEmbQ9MrJyZpgFoPK78g+KnLv8jz51ifX0geSLt7lfqCIuYLqdYGyZshfdX1V7P34mRTknxflq8kvYAilkuxEUz3N3N/3EXj+ABAW2PmEUX7uK0+Z+N6HFZbEge6JSQ== 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=mT8/mAT8shLV282Zsvnvo4svacoG9/UwtUszN3qGhRo=; b=yECl+rzrqxVANYd9wzHZxkmPTnysKWKDu6vMPkONaSrBax1wQvgZd5gJOdFpk3R5h/LycbGvul/n43vockMcd6BpCKm1l+pxRs6dEqxiRqJLF/Mds8V06gb48+505iIT76+duUH+oh/ZM25Pt6vot/eQO917ClX7kuRBTxCxGCuim5oLr/ZSnl2uu3TBFcBowkw8hOPQn3zodeUDqZf7fVDiyLwXhY9iyHB+qmDwuSZadmLHRLjIRHid25zH/1S4FReL874cFt3RHYZrjGYtMCqqKSm/gb4VfsJRSLPdgAIqtTBYfdDuHObz+mQCyY4XJCaGcarRz1JGzw5IKYAylA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 69.169.224.1) smtp.rcpttodomain=virtuozzo.com smtp.mailfrom=eu-central-1.amazonses.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com; dkim=pass (signature was verified) header.d=amazonses.com; 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=mT8/mAT8shLV282Zsvnvo4svacoG9/UwtUszN3qGhRo=; b=EQo5ZnJA/VFxlybpWOT6+mo9L9TV7Jl9rVk/XZFFL3outDmjL2uWO4nsH+lMDOHMN0hOntZkE3RlVCKnVomXnE+xNVOOEGUttxrId8iPZIdYLAbsjnFYPKijmGkZHocgH0LnsusPem4z49ZNQXOEfI7EHV+kT/kE6j/pb4vNqoU= Received: from VI6PEPF00000205.AUTP296.PROD.OUTLOOK.COM (2603:10a6:808:1::915) by MRWPR08MB11705.eurprd08.prod.outlook.com (2603:10a6:501:96::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.496.13; Mon, 5 Oct 2026 09:30:47 +0000 Received: from MI3PEPF0000849C.eurprd03.prod.outlook.com (2603:10a6:298:1::7b) by VI6PEPF00000205.outlook.office365.com (2603:10a6:808:1::915) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.7 via Frontend Transport; Mon, 5 Oct 2026 09:30:47 +0000 Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 69.169.224.1) smtp.mailfrom=eu-central-1.amazonses.com; dkim=pass (signature was verified) header.d=sashiko.virtuozzo.com;dkim=pass (signature was verified) header.d=amazonses.com;dmarc=pass action=none header.from=sashiko.virtuozzo.com; Received-SPF: Pass (protection.outlook.com: domain of eu-central-1.amazonses.com designates 69.169.224.1 as permitted sender) receiver=protection.outlook.com; client-ip=69.169.224.1; helo=b224-1.smtp-out.eu-central-1.amazonses.com; pr=C Received: from b224-1.smtp-out.eu-central-1.amazonses.com (69.169.224.1) by MI3PEPF0000849C.mail.protection.outlook.com (10.167.240.187) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.472.14 via Frontend Transport; Mon, 5 Oct 2026 09:30:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1791192646; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID; bh=f3fbGp3LasO/dgcXv9AopMR+Y/ZaKw3C8Jmz3FBLKSU=; b=ZSXU4Kb6DDsSkVpJzub2V1htrrt5w54gJ7xuRHHXbICf6Or6Y7lnq64D35h+hVO/ 8ipXvDODmSLtbAa/hrOzn8qrF7LeMkIlHT/ZRrlWzt7BAAn0J9bRyw2cLcau7zXMSXV z2yHGlGCt+I6A20PWZE7ve/P931/Ufc7Y60QNMRsJrZ2W5HMIirYf8WXVevk4Um6NOx cMQ4DGqta2DRQm6NQInixxAFEJt8xk+yPGBDzTKqOYuRhmGrJ1Di38VIuBtGu1/efk1 TXO0uPhxIgx/wkCXbF2NiuBQmGyBqic5YFbyADOeK5026thqSaCcMUH67qGktliANpQ 5lSmdsJJSQ== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=sokbgaaqhfgd6qjht2wmdajpuuanpimv; d=amazonses.com; t=1791192646; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Message-ID:Feedback-ID; bh=f3fbGp3LasO/dgcXv9AopMR+Y/ZaKw3C8Jmz3FBLKSU=; b=T/1qcWpAiXOe5PRWG2I0wGrJamm15PWUQWqJ2Ngd2oE25BZkrT+pVdbpf8mghEGM JUu4DDbIiWYU3ljs1cLAp/JCysJ5mH+pO7HrbWMGWqJxPwm15I1qvle0nlG9szc90VO EtTziOQlTige1jEFy+Dy4zRGhU+mlSDDwPm2bho4= From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH hci-8.0 v2 2/3] chardev: preserve the logfile fd across cpr-exec #VSTOR-148304 To: "Denis V. Lunev" , svt-core@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org In-Reply-To: <20261005092635.3564485-3-den@openvz.org> References: <20261005092635.3564485-1-den@openvz.org> <20261005092635.3564485-3-den@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 5 Oct 2026 09:30:46 +0000 Message-ID: <010701a10b66c361-2c3f8ef6-a8e4-43c8-8abb-5b43894eb0d0-000000@eu-central-1.amazonses.com> Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.10.05-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MI3PEPF0000849C:EE_|MRWPR08MB11705:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 97c52476-f1ef-41ff-0563-08df22c35632 X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA List-Id: svt-core@virtuozzo.com X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|48200799018|376014|61400799027|32142699015|9140799003|5063699009|56012099006|4143699003|10067099003|18002099003|55112099003|22082099003|16102099003|4113699003|5113699003; X-Microsoft-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bWgzN2VNK2RiekJCdnNaZ3Iz?= =?utf-8?B?YVBWZXprQVZ5djl5VjhzbFFSUE0xOE1IZkl4MmhIVjVSRFd0Wm8xUTc4U3FX?= =?utf-8?B?UHIxbmxhMjVXVExDbHhIOTQyQlVKZEtDNCtVbUNaUTVaYVpWU0NNVVVxRC84?= =?utf-8?B?bjU5MFYyMXd0V2V0eHhvNStWa3FsbHViZHB6L2U5eXRvcnJyeWVTUVJQMGFI?= =?utf-8?B?cWtGeEhvNnhBb3BCaEFtS05MZ1h6ZWwvZUoxbmJ4RjdiYXdCakdIYmt2d0Fq?= =?utf-8?B?UUVIV1FKSGFlTStZVHpvY1U4Yk1pdDN3QmdLQVY4ZXd0NnBOVmhGWm1nNjZ5?= =?utf-8?B?S0EyRE1IbDEyQ3N5NGxnMDc0TjBIaWYvbFgvdjJUM1MzUVhTa2RNb0NmUGo1?= =?utf-8?B?VnZ4eW9uR0NLTlFLb2RpSnlBL3I5YjJnZWhEMit0L2lnc3BuQT09?= X-Forefront-Antispam-Report: CIP:69.169.224.1;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:b224-1.smtp-out.eu-central-1.amazonses.com;PTR:b224-1.smtp-out.eu-central-1.amazonses.com;CAT:NONE;SFS:(13230040)(48200799018)(376014)(61400799027)(32142699015)(9140799003)(5063699009)(56012099006)(4143699003)(10067099003)(18002099003)(55112099003)(22082099003)(16102099003)(4113699003)(5113699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eTrboE3crLTo7Bu7Ioepl8Bbdl0UMRsuaAeTzh2Z4GfN6QghpmvFAQ0b/dvRFDDaAVmY1ho/65hB2ZcwqRO6IBecMAuLj2CimoUah3MubHVMO1EqC6UfV07yRh7ZvBIveeZAoDTrQKQXuiC9w8AgwpksTfN2Q/t50Fc7BYMuNUBKwfNvwpEXx0+Vq1v5QIZnP0GxbPxonWcSrS547MPnCXeceQuYS+F2cYCf0srCt6ZOqICppe8A2rSJh1pAGDVFzXc1fwDzD7uNbzRfBDbgsZgLjURF19cDwcU8o5uGjDiCelSgsD0qoEjMjJgn54n4cMlX89lvbu+kSPAIC/Jl0BZ4SwPzoeUnA5c/ragiLrGcuSQk3nOnNYo5pMfMQlIOmcjJcTEaex5MKM2HPVqUZs22g9GAfzg3Gv+1VVk656H0kaxi14p3oR/kqmMdMskK X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2026 09:30:46.9323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97c52476-f1ef-41ff-0563-08df22c35632 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: MI3PEPF0000849C.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRWPR08MB11705 Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Low] chardev: log fd left stale in CPR registry on cpr-transfer target -- commit 9181fad86181ebb4fb1b78687516f5494301eab0 Author: Denis V. Lunev chardev: preserve the logfile fd across cpr-exec #VSTOR-148304 This patch saves the chardev log fd in the CPR fd registry under the chardev label. On cpr-exec incoming, qemu_char_open() takes the fd from the registry instead of reopening the logfile path. char_finalize() and char_cpr_claim_fds() are updated to keep the registry entry consistent. > diff --git a/chardev/char.c b/chardev/char.c > --- a/chardev/char.c > +++ b/chardev/char.c [ ... ] > @@ -261,9 +262,21 @@ static void qemu_char_open(Chardev *chr, ChardevBack= end *backend, > } else { > flags |=3D O_TRUNC; > } > - chr->logfd =3D qemu_create(common->logfile, flags, 0666, errp); > - if (chr->logfd < 0) { > - return; > + if (cpr_exec_is_incoming()) { > + chr->logfd =3D cpr_find_fd(chr->label, CPR_CHARDEV_LOG_ID); > + if (chr->logfd < 0) { > + warn_report("chardev '%s': log file was not preserved, " > + "continuing without it", chr->label); > + } > + } else { > + chr->logfd =3D qemu_create(common->logfile, flags, 0666, err= p); > + if (chr->logfd < 0) { > + return; > + } > + if (!cpr_is_incoming()) { > + cpr_delete_fd(chr->label, CPR_CHARDEV_LOG_ID); > + cpr_save_fd(chr->label, CPR_CHARDEV_LOG_ID, chr->logfd); > + } > } > } [Severity: Low] On a cpr-transfer target, cpr_is_incoming() is true but cpr_exec_is_incoming() is false. Does qemu_char_open() then take the else branch and reopen the path with qemu_create()? The log fd that the source saved with cpr_save_fd() is part of the registry that cpr_state_save() serializes for MIG_MODE_CPR_TRANSFER as well. On the target, that fd is neither used nor replaced, because the cpr_save_fd() call is skipped by the !cpr_is_incoming() check. Could this leave an unused log fd open and registered under (label, CPR_CHARDEV_LOG_ID) until process exit? If the target later does a CPR save, the stale entry would be serialized too. Would the Permission denied failure described in the commit message also still occur in cpr-transfer mode, since the path is reopened there? [ ... ] > @@ -315,11 +332,14 @@ static void char_finalize(Object *obj) > if (chr->be) { > chr->be->chr =3D NULL; > } > - g_free(chr->filename); > - g_free(chr->label); > if (chr->logfd !=3D -1) { > + if (cpr_find_fd(chr->label, CPR_CHARDEV_LOG_ID) =3D=3D chr->logf= d) { > + cpr_delete_fd(chr->label, CPR_CHARDEV_LOG_ID); > + } > close(chr->logfd); > } Related to the above: in char_finalize(), the registry entry is removed only when cpr_find_fd() equals chr->logfd. On a cpr-transfer target, the stale entry holds the fd received from the source, which differs from the freshly opened chr->logfd. Does that entry then never get removed, so its fd stays open? I did not find any code that clears it, and the follow-up patch only adds an iotest. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/2026100509263= 5.3564485-1-den@openvz.org?part=3D2