From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 1770180027 for ; Thu, 19 Nov 2026 16:21:13 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AJGJt1V028924; Thu, 19 Nov 2026 19:19:56 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJGJt1V028924 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="iP7AeVoe" Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AJGJrxg028918 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 19 Nov 2026 19:19:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJGJrxg028918 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-6b4f1fcf171so2393872a12.1 for ; Thu, 19 Nov 2026 08:19:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFl102ibxSJdWXLZcaiwlAr4sIZ6G+GLrTalDZRZaXyHS1GbhtibWKQc5Cz+kli+fHy+tj6uw==@openvz.org X-Gm-Message-State: APuU4Z8ey1oyxjOcQMg818Ecd5Dq2XDpetiD3F/m95iv5eHnbMGiFkK1 E2HCrydGfgRNgUV4LnEsits06iG42ePKRdHGRx6xUFtbUUUkx9x3rJGZqSj/zhhlFLPuuSpezQB JE4Hm9irCEGEiHxZMMMrMGzqbPoVNsDUGUt2ChErk1mTxQR+f7ZVyiA== X-Gm-Gg: AYBFou1xFnA93zAJidQA93bsMsRnfgx8xo7RisJ3CgCzwszTwyKOw8suJHfU9mOCSNW 0KWvfIXiz9rm2/veKztjDa9OfkXsHGzrirIMNxA2H2Tu+tgwg8N4QVxTgUYDWsrnWQOhBK+xHUD 2pZYZp5rJ6hWjWUeqmYf9LP7mSoJ4UKkvdqwL0RgXqBOCkCzpqUGl48K3IzCFKrFYE+lkWTpwTb yessjw+gHGDHn0QUGhjplMd2cACPGEoGZhlrAHrMfVbkCgNSd5932inokO6pTazM95XRKQJ4iNu /cetio0hy9ipkrxcfip9CVlwQdw7WGUs+GWrCLrLIOzuL8kuRiokv75LBwldpvzAxQ37YuSMiX+ Va+Hp7vm2MuQ7piBA X-Received: by 2002:a05:6402:364a:b0:6b7:186:e60b with SMTP id 4fb4d7f45d1cf-6b887c8bbfemr5940870a12.5.1795105193310; Thu, 19 Nov 2026 08:19:53 -0800 (PST) X-Received: by 2002:a05:6402:364a:b0:6b7:186:e60b with SMTP id 4fb4d7f45d1cf-6b887c8bbfemr5940836a12.5.1795105192767; Thu, 19 Nov 2026 08:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795105192; cv=none; d=google.com; s=arc-20260327; b=gCa65SHwJyGYYLlf01tkkAurYh38MUIqDdU7dPh6l01myh4KZn4/VsA4cKMPtmw+ue uINiWCswQJ4wP1PVA6CGXzfL8FFlEXCtJM94DhdGnLKFggo1Udcf301KJqp9AFBC3mUe I9SATtI8wWbnFG2hblA4hCF4JtpWa3aDfaBExMra9V6Ne03HonP2D/rCMCfX5MNY06Fb PwHKh1lcmfbXBY9m8obKQOSlgaTvwWRWuH4tkqaYW8W3C+nO8H8LSS7YgpgdBYrqiFn4 eS44D5dF5+Tb+4V6tV5m3fHcMB7kltPZFphAlKkcR3i5/u767JkTaGO2UfXSgmmeLuIc c1lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=5gCacMaRZlpbZFO38V1adfWS9LRhw5pIKGnQvhL4RpE=; fh=o67S70d7bYBchkHhg/lccNR88TMdTJwrA4siEW/Vy5M=; b=rGq26StrakhWgmcZO/99alV8SWAdddjbcDE09TR7vu+dY0HKxAZ8c072o0NJ7YVlN1 M94sudC+qc4Cc6hM5sY4hO4YvTDh1fQhQ8+RhY5xqXH5270U2Olc1YBuLFtZBukBSKwg vhAyUvbO5p0idQMG5yF2dwJCFpG7Ju2PqjlP9hD24KMoLYPc1WIfSdwhIYGyiXuiER/6 /NVcgET1o7hOm4YQntykaQPl5QBEQUOllj6q5Ob/8D//r0Pz8BXGR93kMCOBV1qk4RvN vBTXr2ZqExsBP0J82CVF7sN2zbwSlErV0Tm6NHMzKjCMkxx+fGrMluiOB1ZQBm4pDbEj oJIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iP7AeVoe; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-6ba373fecb4si26388a12.266.2026.11.19.08.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 08:19:52 -0800 (PST) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iP7AeVoe; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=5gCacMaRZlpbZFO38V1adfWS9LRhw5pIKGnQvhL4RpE=; b=iP7AeVoeepFk 7waxsFDm7ki3HvBmNRkeffwL6IDYMXMe/iTLTlIBMNULU7ubYh7qIErjPxIZir8KRcKpo9u0uKqIc UbxspIaljPr0MkdN6jEI4VwFqYG+WCmTK1OiB2iVO5UxwxYq9UxPM8YyA7KRAQaeliw6hQDfhf/KV jRKTenZ96TWXYP4C7HjZ2rjm/drf40QfGWnx3eejVPAaKTDwBpwRAZKxCgPtDILIkJa+Z4BxR5EL4 wPfesaIVtV5nRsXX3qUzxt1pYHrvp36POuvWFGNaLVYsgZnh63KSkmzBk8sutuARTAR7z/xyJzhaM b0YDMQ6HjQqZ8NHtPbzeig==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xU4rV-000YOv-0Q; Thu, 19 Nov 2026 17:19:49 +0100 MIME-Version: 1.0 From: Konstantin Khorenko To: "Denis V. Lunev" In-Reply-To: <20261118190006.3573492-1-den@openvz.org> References: <20261118190006.3573492-1-den@openvz.org> Date: Thu, 19 Nov 2026 17:19:49 +0100 Message-Id: <179510518988.1461989.17561253528990728836.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2891; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=06rED6PGWcuY7zC626ACpVKPyTwTOMt1LHFH4pIAvaI=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq/yGmBtXEtslR1bFm1rj82RyWakvNW3hVLQNvV tvLKcsOwFGJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCav8hpgAKCRBRlgpH+WFc Kr26D/wMAyhTa7wljQvBs1b1PcjWv2RPI0C66uY3p6/5FTyMRiSa6pN4JQQkjdLSbGHJ/fM2BUp nZyONwNDx3UFWZ3qZx/rLaZ7rpRqITYdQnD4MpPbzR8qozXsQEx8tz1DRoqKSoHhvd3ROwNgbA4 Oncb5RAjzjSuEjxBLGq9CIdBx9OIfhuaSx6MbnPkE724zTnjewN+hvzzxL8Jxng1hBFqZzD+M1Y MS6YmRCldA6w3HJtPeNB6QYQ+d5xw4PdczMSvtA0rdeo12J0RAWe/WaQ0t4jLIkadz//h3ak/33 zU3n0p7heyv9+qHFo2VqkkjQIIdf0XvdYrOU/llZjJOPTb74loefGKqJWQnEeDkq58+9kGrA6+d CfKzpkZWvlydmA/CnPRRdpdyQM4khI0nFkoRzi8+p8L/zejazbRQXmfqvgeZ8fkiFtBBAcb8b0N Yi8wJwqiL/cg/84x8AP8djRBHqxnAEG2mmAzgUHA86EGaqgo9Vv8SLS8pkrYLusunQqDt/bfBVi SX5METW0mhgaWOMtqwwwahaOD6FK37A8BIWHnrKaD6euxC0QqBlcOT+l0VeW6JEa5ffH3WtZLI+ JzpPD3B5y6TtCxfX4eAzVwlXNvqRB4q6VVUOV3rb2fQavuzacFwutjRqNX+ZiZEbtiJQ0MfdCrm telWJoKB/ED98dA== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.2] dm-ploop: fix an ENOSPC endio arming the timer on a freed ploop X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org Applying with these fixes on my side: - Fixes: 6ddad5a4d226 -> 90bb85536272, the driver add in this branch; 6ddad5a4d226 is not reachable from it - "The endio does not touch the struct ploop after the unlock" -> "ploop_try_delay_enospc() does not touch the struct ploop after the unlock": its callers still do, see below - the first paragraph split before "An endio that stalls" Separate patches, not needed for this one. I created a task for each: 1. After the request completes, a split write still frees the child pio into ploop->pio_pool in ploop_do_pio_endio(), and a write that allocated a cluster still runs ploop_bat_write_finish() and ploop_put_piwb() on the ploop. From an async fs completion this can run after ploop_destroy(); not specific to ENOSPC and older than this patch. https://virtuozzo.atlassian.net/browse/VSTOR-155932 2. dm-qcow2 has the same window: qcow2_try_delay_enospc() arms enospc_timer and queues event_work after dropping event_lock, and the destroy path neither shuts the timer down nor cancels the work. https://virtuozzo.atlassian.net/browse/VSTOR-155933 On Wed, 18 Nov 2026 20:00:06 +0100, Denis V. Lunev wrote: > Hold deferred_lock from the wants_suspend test through schedule_work(). > ploop_presuspend() sets wants_suspend under the same lock, so either it > finds the pio on enospc_pios with the timer and the work already armed, > or the endio sees wants_suspend and leaves the request to its caller to > complete. The endio does not touch the struct ploop after the unlock. The fix itself is right: no lock order or context problem, and nothing calls an endio under deferred_lock. > pr_err_once(PL_FMT("underlying disk is almost full"), > ploop_device_name(ploop)); Alexander suggested taking this pr_err_once() out from under the lock. I keep it where the patch has it; the options were: - After the unlock: no. ploop_device_name() reads ploop->ti->table, the md and disk->disk_name. Once the pio is on enospc_pios, presuspend can resubmit it, the request complete and a remove free all of them, so the first ENOSPC delay after module load could read freed memory: the use-after-free this patch closes. - Copy the name into a DISK_NAME_LEN buffer under the lock and print after the unlock: correct, but it copies the name on every delayed pio, or needs a "once" flag of its own, for a message printed once. - Before spin_lock_irqsave(): safe, the request pins the device until the pio is queued, but the message then also comes on the wants_suspend path, which does not delay the pio. - Under the lock, as now: printk is fine with interrupts off and the console path does not take deferred_lock; the cost is one console write under the lock, once per module load. Thanks. -- Konstantin Khorenko, Virtuozzo Linux Kernel Team _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel