From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <010701a1e494016a-74195a25-611f-4fa7-8bd0-b2d6e7948939-000000@eu-central-1.amazonses.com> Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11023119.outbound.protection.outlook.com [52.101.83.119]) by lore.virtuozzo.com (Postfix) with ESMTPS id 99FDE8017D for ; Mon, 16 Nov 2026 13:37:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=E0Zu3RSHvzO/B83TwVXCdqDuyGGKV864MlP0NMEXkN+yfnDp4i1JVn3T9yGNQvG/ZrNQ5RMaNUk8cVYtOTH+R/dF7whGc079mBGMiNY+nNivWsaUnSIuYVknyeBF6GDyWjJRtcUJS7Ri2nEIXuT9fR14qMQiJko2W7a4ZCgoUw0sjlnKCxyHifx7GpsNHfwrE2n/HuhSPXZUd6EjAF17NQwIrxi8CXkTuFyXtJnSV1DdU9J3zpnIFSk3JYFE7xYgfy+nnMndLwOlFUz6411F8ChFQQCMcKfVoEiNPR47QklciQEaR8n3xZtt7Mc35iKuDe1VwJ79mvIJsmD+J2+4Mw== 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=+jJOLpYArEf/pvYRlwsWwBhHlmCDao2BzuM2EBsX1fQ=; b=pfeFxpb9PBWAeJhngI1zA/3v/oGy//Mi42vCv4C23ZtucYkP8N7P3x3Vwc6ERwBsh4KMKzrbT30I5ScJ4OpyohvCwjZ6yBfAJn++WcL5DWSvz2lZ7YuI322Q0hej8YfAVT4h/g/fmsZmByJlfYiRavajpk244rYsVOspHfWNmdmOmsXDM5/XAYNZoKBfIgX3OXXHDp3CHbrG/cQVJCYvn2ZZzP9Knd7jsX9MrtLcibWuwwr2y21uFpJQiRTb7xRu0oSNJrzjqfwSQdOHfuud3ZNzpEliz0SkHnXZUqszQdzPWVw3n6UbduAFmBDj5TRmbcy6Ic0BXXTBCwPPYlqQcg== 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=+jJOLpYArEf/pvYRlwsWwBhHlmCDao2BzuM2EBsX1fQ=; b=CRHo2gN2AB2fu9Dv0GBzVVX9oXAMpzSLGO3TDBQm6WxxepsH0JRndcft5X+HMet3CFb/xy0Yl+fTNzsCupTp30VLgIJNcTg1emctlS7YySTJxI2zZ7084oSUquMloqGO5H295xXwTxJD1B+USXiqiB1dl85tZXabrYDhIWuj3JM= Received: from AM0P309CA0001.EURP309.PROD.OUTLOOK.COM (2603:10a6:20b:28f::35) by GV1PR08MB8036.eurprd08.prod.outlook.com (2603:10a6:150:97::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Mon, 16 Nov 2026 13:37:48 +0000 Received: from AMS1EPF0000009D.eurprd02.prod.outlook.com (2603:10a6:20b:28f:cafe::90) by AM0P309CA0001.outlook.office365.com (2603:10a6:20b:28f::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.639.2 via Frontend Transport; Mon, 16 Nov 2026 13:37: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 AMS1EPF0000009D.mail.protection.outlook.com (10.167.242.74) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.615.4 via Frontend Transport; Mon, 16 Nov 2026 13:37:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=23yjbh4k34hwzfubhuiim7m4inbd3ick; d=sashiko.virtuozzo.com; t=1794836267; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=MOrfouvKB/Swj6VGAFXCSWhSMv/8QAGQGND9ymvheYk=; b=RyCmPP8Sq714L4f5eCrIFneAKYpdiCN9YML8yFwsNXN9+CHJQnF/r3ChirXjZdlK xKIMLM1GxcO9Wy9l2PCkoE2Cyle851SzdC0qO24OC7+gnmQYZQIbft5RVdKB36OzJ5+ RC4Fw1g2UDrffSEwis84iv1tSjx9k7XTOGyYnMXy+y6rRKlSmFJO6qEzp5MYFPk3qiw XJY3yPb6pHZWOtasWs3GfXlXlCJU9ZRXC9WoKfJw2ltpy2RKGo8AI4baMsMsFTLEB7s rPHmi6OsCKnCV/9S9MNhDpxWCHe9BvuZ3zGlPO0N7EnDKSTzhw3O1Q1arA/ScrI3pXs 3A5QBtVwLA== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=qftdzk2dqsatjnlrq4r5brjbihpfcrsh; d=amazonses.com; t=1794836267; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=MOrfouvKB/Swj6VGAFXCSWhSMv/8QAGQGND9ymvheYk=; b=VlHEghm1N6t8v8r6BeCI0f7wrpWrfbdgSAsfZgmdY9fLR5tpjoakIYgypnt6sraS Rv3xKs7F0eQNmjZF7jZwHfrrI1W8UHsp+NzXDBMhQiyTUNrTOku0sMTVjDPYKsuLKJv 6qWnN1F1O6hGm1jaakB1hKIqQDcVA9zO9TftU+iQ= Message-ID: <010701a1e494016a-74195a25-611f-4fa7-8bd0-b2d6e7948939-000000@eu-central-1.amazonses.com> From: no-reply@sashiko.virtuozzo.com Subject: Re: [PATCH hci-dev] monitor/qmp: cleanup SocketChardev listener sources early to avoid fd handling race #VSTOR-155186 To: Andrey Zhadchenko , andrey.drobyshev@virtuozzo.com Cc: svt-core@virtuozzo.com, den@openvz.org In-Reply-To: <20261116133056.1046875-1-andrey.zhadchenko@virtuozzo.com> References: <20261116133056.1046875-1-andrey.zhadchenko@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 16 Nov 2026 13:37:47 +0000 Feedback-ID: ::1.eu-central-1.2wRQJBpg9g1fGRYexx3dUuYGS25Bux+2TEOx72/m6U4=:AmazonSES X-SES-Outgoing: 2026.11.16-69.169.224.1 X-EOPAttributedMessage: 0 X-EOPTenantAttributedMessage: 0bc7f26d-0264-416e-a6fc-8352af79c58f:0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS1EPF0000009D:EE_|GV1PR08MB8036:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9f9b8e9c-606b-486f-700a-08df43e6cd71 X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-MS-Exchange-AtpMessageProperties: SA List-Id: svt-core@virtuozzo.com X-MS-Exchange-Transport-Rules-Loop: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|9140799003|61400799027|48200799018|32142699015|376014|10067099003|56012099006|5063699009|261026121527099003|261026140227099003|261028144727099003|261022105027099003|261009223027099003|55112099003|18002099003|22082099003|16102099003|5113699003|4113699003|13003099007; X-Microsoft-Antispam-Message-Info: sBc+gBscAXxb1qjO6IX+Ag2aM13EUp8Z+ypEk7dwHRTWFbGWma111o6xVCO2LTAgl3Y2BWWXUMJhYfC/6a8VAp5puNT0TaQBsTlnEiOraB45Tri0d4MaoeH5AzCJYtxfuB2XRcHHx43o6xKi1r6FWimxKg5g9EkE2CLAyzqJcTXaIMfhYz4pcEt+qL98TPDGEXnp5ViZoQhHY9l3piPIy4gCDpnHjWrNwBQ2lgJpIQYMvzaFfiMa/mmQKYxb0wJisYoRJ42K29eGaLvJteKo4X+XrKz4nRPjwv4f7qQFegLZKcPYcvUsj2LEpyu6D3MW7It34cnwoR5k6bkAbTm62T79N90aft6IPKy7z7mdqYgusThSBDkA4bplYOzHxuAsRND/Be+nxsfSRjJ/m+a+J29eHrgwvTIjqNaFzK1sux6/eQI+QJGzQv86WAkWTaQabcyOBuBL1mfV7RcMMpfla6zQtHlf6khUG7ZMKHBNRNfnbY+lrSer/l9xIGjhKDxX/ERMNltbHUyahm+aXEwSn3taM43/QtssTH6sf8K0V4oNO4sgbpuZ8YA7NTXwNluKoZ5b+QBNeV0g/bxn8C5nUhHYlWf7xQjaOtDzTI9QF+2uBpw4L24VagsSeav2GI2uvOXAQ+cABOAp9B17Uf4MaCflLOj7unagZinjkhk44rQTbdgjIWJpmwFOILZzmNCqpO4lRmN5yYz9JumZWNczGS+/sgC6SJnehXLmCHVNTDS5WIJokiqcxjBq/BB2aKnQMtoJTrnoW/57WeRTMSA6YNHkPYWubc6kLAhNF1GExu23c0Rf1ONze4PPCXQSbh09NRA1LQBJmO+M7ma5Ii0Ce1xvOAD656hq0XcllXgidfaplSYCFWf4QeAKJ3qTLufCWGVXZXGeLpXrDiCfjQYuFEi2u6JrR1ZsBzw7PIyqPYmobe6I6p5eEXgvON8h8ClV 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)(9140799003)(61400799027)(48200799018)(32142699015)(376014)(10067099003)(56012099006)(5063699009)(261026121527099003)(261026140227099003)(261028144727099003)(261022105027099003)(261009223027099003)(55112099003)(18002099003)(22082099003)(16102099003)(5113699003)(4113699003)(13003099007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PfwThg0kpRBnn1DRlyz4NscCVf9vRnCi3gfRyfY7nvcWbopc16/RWnnGhciWf07pM9n5mRVuVGJWw+Jv+F48a5Kv35yIxrjUUdL3srvnWMVllzyuFYcUt9Dnf2PlcCcQ+O4rdF6YzsIvLCt6jLJcuKQyEmg0DqP4W6qRyQAkEsGa1Wwy5OD6tCyspbxBRWZ0Pn23PeZH0iocBkJoqJlemSm8Y1JHAyMPO+MnquuI72iUo4TFvmbA7ox6VwvqFCQcekU3EEnc+tPZoW9DAUNHQ8jq+w6kcJwYtSbTTxFS3ULKuBAE2ZeLaDYlfe4swhtGr6LPRHtjIGiiovc9p5A4A5TsWGxdyfRFUG9lxGw9k6zdGh/uBgF3Q8j8PRxIOCy21nQQcyKqbPTxFZdlbUqoKBQMgfQC8nFYavKi5kW/FYjHi+TzdV13Dm6XA5+Fr93o X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2026 13:37:47.7597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f9b8e9c-606b-486f-700a-08df43e6cd71 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF0000009D.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8036 Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] chardev: misleading name and no docs for chr_listener_cleanup hook -- commit 5c8cab67961662e98b03d6e5525ecf5fdb9c1a1e Author: Jie Song monitor/qmp: cleanup SocketChardev listener sources early to avoid fd handl= ing race #VSTOR-155186 This commit adds an optional chr_listener_cleanup hook to ChardevClass. The= socket chardev implements it by dropping the listener's accept handler and= IO sources. monitor_init_qmp() calls the hook through a new helper, remove= _listener_fd_in_watch(), before the IOThread takes over the QMP fd. > diff --git a/chardev/char-io.c b/chardev/char-io.c > index d9b11f335ffb6..0e5ba316ed9fb 100644 > --- a/chardev/char-io.c > +++ b/chardev/char-io.c > @@ -187,3 +187,11 @@ int io_channel_send(QIOChannel *ioc, const void *buf= , size_t len) > { > return io_channel_send_full(ioc, buf, len, NULL, 0); > } > + > +void remove_listener_fd_in_watch(Chardev *chr) > +{ > + ChardevClass *cc =3D CHARDEV_GET_CLASS(chr); > + if (cc->chr_listener_cleanup) { > + cc->chr_listener_cleanup(chr); > + } > +} [Severity: Low] This isn't a bug, but the name is misleading. Sitting next to remove_fd_in_= watch(), remove_listener_fd_in_watch() suggests it removes an fd watch. It = actually calls the backend hook, which for sockets detaches the listener's = accept handler via qio_net_listener_set_client_func_full() with a NULL func= . Could the helper get a name or a comment that says so? [ ... ] > diff --git a/include/chardev/char.h b/include/chardev/char.h > index 968766fd5d5ee..62cfdc2d3d765 100644 > --- a/include/chardev/char.h > +++ b/include/chardev/char.h > @@ -313,6 +313,8 @@ struct ChardevClass { > =20 > /* handle various events */ > void (*chr_be_event)(Chardev *s, QEMUChrEvent event); > + > + void (*chr_listener_cleanup)(Chardev *chr); > }; The new chr_listener_cleanup field has no comment, unlike its neighbouring = hooks. Could it document that the hook is optional, which thread may call i= t, and that the backend must re-arm the listener later? For the socket back= end, that re-arm happens in tcp_chr_update_read_handler() when the state is= TCP_CHARDEV_STATE_DISCONNECTED. Also, the commit message says the IOThread only removes the main thread's f= d watch when it reaches qio_net_listener_set_client_func_full(). That is im= precise. The function destroys the old listener sources and creates new one= s in the target context. --=20 Sashiko AI review =C2=B7 https://sashiko.vzint.dev/#/patchset/2026111613305= 6.1046875-1-andrey.zhadchenko@virtuozzo.com?part=3D1