From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11023122.outbound.protection.outlook.com [40.107.162.122]) by lore.virtuozzo.com (Postfix) with ESMTPS id 29EEF80027 for ; Mon, 23 Nov 2026 21:29:56 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IEQ+/BFjs+Bp4W3SdoAPV7llCg12aoIof8rJlOfbL97ggPS/0zyASH/ElimyP4j2am0x+VSvHVRdkwHDryIHy+MVcOZrUjZcmNyj9hrhgoZaXQbMNaXGp0C9+7iLe24iMfKYauVSAGPzhYkaSFqEc2VRXzPziPoST23xSwthXjoLpgFzG/nqGisdZjXrFrcJ+W8IsEZt9b5O53fOQt0Ec/ZqFdJIBEoEuNa+jFASJUjdrC93vBBMX09jfXh08gntUgo29FHEdrAmHw6Fy6EIlr1W4BGoUjEhbib00VRxxLlMHVUylmbggbKEEnQ9vG1nj0UajWt4E7XaU5LrIZsflw== 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=enOUh5LK882MAMvoZhbNx0gDKHrUV1CHiRNj6FAyHLE=; b=WN4HN9TPlmZjLJG+VVznZOhdFm36tuR2lBlH76OepbZ72AjeKd5aPkIBV4Y3n/dZZwp9FnPfozPPcWv3ZTwkfrpFC3xHXwVJG1zCN4s4l1m2aKeW19SY0EC/jEwEZpaZQy42vxtGG56B/SCdDzLWT3wm9O+nM6g2lwScWYNNd2Rfe8ugYMLjYE6o0lPfrBnLuvDMc5N2X9Ob3sNRyIBT33FFzkYvBGEUrQ76H4pd4x3C8NQz6VWF9DyPOWUbYuBkhokIyq/Yh1Yr01/5tfgem2L0fOgtYzawdsYGUHuTmHFI6SebhEymIzKJvXnCB9HRHe/haHrEdIW19cllf0HQXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 2a00:1450:4864:20::435) 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=enOUh5LK882MAMvoZhbNx0gDKHrUV1CHiRNj6FAyHLE=; b=AGXya5R2cZuIjt3WesvQ1noQPpi+yumGBINx/MUGqPh8EiHbnAddgKRPtiVhe6LJcDZiSghmaZrmn1JCOP/+s5ZfhudRGeUml48ewh+N37keSGRHG3iGS0r2tnDEPzKhmWEg5kQOHCWSa/pnrFGA5SUYgV1v6NXxyLmas9n5w4g= Received: from GVZP280CA0081.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:274::8) by VI6PPF7F6019F94.eurprd08.prod.outlook.com (2603:10a6:808:1::58d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.639.10; Mon, 23 Nov 2026 21:29:49 +0000 Received: from WA1PEPF00009B3C.eurprd05.prod.outlook.com (2603:10a6:150:274:cafe::4a) by GVZP280CA0081.outlook.office365.com (2603:10a6:150:274::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.496.5 via Frontend Transport; Mon, 23 Nov 2026 21:29:48 +0000 Authentication-Results: spf=pass (sender IP is 2a00:1450:4864:20::435) 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::435 as permitted sender) receiver=protection.outlook.com; client-ip=2a00:1450:4864:20::435; helo=mail-wr1-x435.google.com; pr=C Received: from mail-wr1-x435.google.com (2a00:1450:4864:20::435) by WA1PEPF00009B3C.mail.protection.outlook.com (2603:10a6:1d8::11a) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.639.5 via Frontend Transport; Mon, 23 Nov 2026 21:29:46 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-4ad6219f7d8so3127383f8f.0 for ; Mon, 23 Nov 2026 13:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1795469386; x=1796074186; darn=virtuozzo.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=enOUh5LK882MAMvoZhbNx0gDKHrUV1CHiRNj6FAyHLE=; b=bJJLR265lnRhksloPgHyceegHBR0IehtY9Vm0M+KPUfqSjbZqoQs7W/NoHeZJWqOQX 7PI3RHkRxmcQ3kLQP1bvyW7mKzrLayQmLonaJM9G+KHvHiv+WJ4G4fqX2lR1yY+9c5BZ bS25ESaBq0C7PyBvPShCeWosmyVBqLMubNxKNxwfk2OrphtzBHBeWHtqIuqeJcfueBGE Vv7wYSZJE2BuSopONPM/HfZ7yFq+PRLLHyAV1rzn5wDm8ehwIPNGoKUV3J6og6UCfrOJ TKiD+MRKp+2s3Ams8izClUh3hG82YLXFXZydClApYWV0OnCdZktJN7OWKtI7U6zr8Rs2 75SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795469386; x=1796074186; h=content-transfer-encoding:mime-version: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=enOUh5LK882MAMvoZhbNx0gDKHrUV1CHiRNj6FAyHLE=; b=RB4vGbJTyPte14fdkvxsL9i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bfI QORJLc3JKNA2Szi5saT0p6yLPtA= X-Received: by 2002:a5d:64eb:0:b0:4ae:e824:1fa8 with SMTP id ffacd0b85a97d-4aee8241fc9mr14282307f8f.9.1795469386112; Mon, 23 Nov 2026 13:29:46 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:62d2:2eda:8655:4219]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6baa3c4dsm20288763f8f.46.2026.11.23.13.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2026 13:29:44 -0800 (PST) From: "Denis V. Lunev" To: svt-core@virtuozzo.com Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org Subject: [PATCH hci-dev] monitor: fix abort when a rate-limited event races with its timer #VSTOR-156540 Date: Mon, 23 Nov 2026 22:29:42 +0100 Message-ID: <20261123212942.242422-1-den@openvz.org> X-Mailer: git-send-email 2.55.0 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: WA1PEPF00009B3C:EE_|VI6PPF7F6019F94:EE_ X-MS-Office365-Filtering-Correlation-Id: 82337c57-2683-425a-fec6-08df49a8e5e1 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|376014|61400799027|43022699015|48200799018|6059299003|82310400026|9140799003|5023799004|261022075727099003|5063699009|56012099006|261026140227099003|261028144727099003|261022105027099003|261026121527099003|261021121427099003|261021123027099003|10067099003|261022113327099003|261102123227099003|261009223027099003|55112099003|18002099003|16102099003; X-Microsoft-Antispam-Message-Info: ZzoAWPUNshVEDpS8CGIA5UVCjyU3p7f96YRefbxWBykvggpG848uVIr4sIBggk9Yuws087UEUKSTYQ1xjdHuV8H6GN7EuhtSN3IAmUmWstDb+9ArGypJEQX2jYaEbgHh3YvLhtZYNOGK1lCxYWEEb3+fy6xteCVCNDKgQTPSW95EmubDvWoDadgBJmheMi0ru4Oi2DONRv4QjPoeDl+V52udVVsK6mDwJC1WbeML454owqINq0bwDzr6MaqmrbMMSpbGY3o11tYAg/0qtGqzuoP4PKafzmRYtu/2X4iQSscPk2h5KRNCW+Szq5npTVYQwhHd6MiU7/HkoU4UMgN/Jycq84KWrIlaEsfIypifbM65goZqVJ9Mq1lLr91hubWKuTTcEfVOKyLZTx8PrM9WfbP23b3i+G0Chj6e2KlSegOyhznqI7FBMPc9pgKMUTLiLJK/IN0ZdFJi4IBfcSVyQYQ9fuh8sX9JuXhbW9yI+Xd8Ea43JdKpU3hSW4rrDWsatWdwnqNe7BQ0lbDflw/lvak46uRtLeN9fKmnfcfvRwMXc21rAKCXOEeuIYL2j6IuwBX9XKlhKdi0fcXySTZkd8+YBoGQbBhirlaOZLlEH7eOX5lScaP5m7o1CWGHrpg4+rNDCFJyQQV2L4o65xlN0Vy6fzoQJzFNhTcQ1WRM2MmvlyGS8OwoSYNnAOb5eAiP3AuPf89AcU0+Jt5UZbeDicUn7iRz5vsLxbLZoR89PmFH9ggrsHskqUvFPxbZSlJdX9KQTEGRTM9lS8mo/to+rx0r4/yulIU73ZzOWJGr+2xV/7mWZAe6V9zlSL+5EDDP4aDu3KmT/9bmsAN6+RJIimPejg5DW8x+aNLcPU9dQu0Lv4HhLvayP3X52rgiuGat X-Forefront-Antispam-Report: CIP:2a00:1450:4864:20::435;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail-wr1-x435.google.com;PTR:mail-wr1-x435.google.com;CAT:NONE;SFS:(13230040)(376014)(61400799027)(43022699015)(48200799018)(6059299003)(82310400026)(9140799003)(5023799004)(261022075727099003)(5063699009)(56012099006)(261026140227099003)(261028144727099003)(261022105027099003)(261026121527099003)(261021121427099003)(261021123027099003)(10067099003)(261022113327099003)(261102123227099003)(261009223027099003)(55112099003)(18002099003)(16102099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LJoi/uKnXAyhoMufVqUfvu1zYINpIXj7cVVqcaLrfCkbrxX4E5CGa4vNhNLH9CBpwsMQ24RLwnxIEf4PZTntl2GtiraBH2w924Y4f/1D0VyuLTZOai2fcgjtrVfLyr1/t9Gcx9pcA68oucCBdre05Fkbg56ToYe4T4z7wS//daOKC89E933pVwtoL56HzJ7si4Ud7Mi/5bUlfejcGCSgS/KFMTK/bvcHSsIstn/I+pTn8l6A9EsiRV2x20xswKHB3GDiGIoYnJ//zwwv68Cpr/KB+k40O9DJgd63p1puF5ArGVSO6TUEfDHOG+if+DTvpCTpgMx9/2hhuZWM7XYM2Qh4aXhTnd0DuMRh5teybzh289GrtNQrfCFBsGguGP0WRFFv+yHQbAcetX5EtpbLyEgNu/88lRdl85Nlfn1kWSNnb90Ufn1itdUQ7br3VXkW X-ExternalRecipientOutboundConnectors: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-Auto-Response-Suppress: DR, OOF, AutoReply X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2026 21:29:46.8116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82337c57-2683-425a-fec6-08df49a8e5e1 X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-AuthSource: WA1PEPF00009B3C.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI6PPF7F6019F94 List-Id: From: Denis V. Lunev Rate-limited events can be raised from iothreads, outside the BQL. QUORUM_REPORT_BAD always could be. Since 2155d2dd7f73 BLOCK_IO_ERROR is rate limited too, and any disk on an iothread raises it. The rate-limit timer runs in the main loop. timerlist_run_timers() takes it off the active list before it calls the handler, and only then does the handler take monitor_lock. An iothread raising the same event for the same device in between finds the rate-limit entry with a timer that is no longer pending, and QEMU aborts with: Assertion `!evstate || timer_pending(evstate->timer)' failed. This hits virtio-blk on an iothread with an error policy other than stop when the storage goes away and every guest request fails. The state is fine, the assert is wrong. Once the timer has fired, the handler is committed to run: it takes the lock as soon as the iothread drops it, sends the stored event and re-arms the timer, exactly as for an event stored while the timer was pending. The event goes out at the same moment it would have had the iothread come in after the handler. The entry is only created, re-armed and freed under monitor_lock, so it cannot go away under the iothread. Drop the assert. Fixes: a24712af5425 ("monitor: Turn monitor_qapi_event_state[] into a hash table") Fixes: 2155d2dd7f73 ("block-backend: per-device throttling of BLOCK_IO_ERROR reports") Signed-off-by: Denis V. Lunev Cc: Markus Armbruster Cc: Dr. David Alan Gilbert Cc: qemu-stable@nongnu.org --- monitor/monitor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/monitor/monitor.c b/monitor/monitor.c index f7703d9bd05..408cbfeac58 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -397,13 +397,14 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict) MonitorQAPIEventState key = { .event = event, .data = data }; evstate = g_hash_table_lookup(monitor_qapi_event_state, &key); - assert(!evstate || timer_pending(evstate->timer)); if (evstate) { /* * Timer is pending for (at least) evconf->rate ns after - * last send. Store event for sending when timer fires, - * replacing a prior stored event if any. + * last send, or it has expired and its handler has not + * taken monitor_lock yet. Either way the handler will + * send what is stored here. Store event for sending + * then, replacing a prior stored event if any. */ qobject_unref(evstate->qdict); evstate->qdict = qobject_ref(qdict); base-commit: dd934872c8855d6ed6752edb41bfd9720d584651 -- 2.55.0