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 4C91781B37 for ; Wed, 18 Nov 2026 19:01:49 +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 6AIJ0H9l028424; Wed, 18 Nov 2026 22:00:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AIJ0H9l028424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1795028432; bh=wekfIkhiPmVmNAh4lsM/SP1WkrCty+jjRAKp4WT7zUU=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=kQQy5L3b7vB5D0rqMvo6fBjKS1SG5UxdCFJh39E9XYSM4ieknVlb8dRlr22lTRQ9S 46zhADe+i45Mh8L+FZUdfjd4IZDEjpd39dgUYT/bud6BerD5UKRQxD96H6Zrs+BmHl ZCJvnTYm8TX62kYZQHM2Su6SwZFnK2FbvEsVe/PRBDx/7gtWhaKSV/ithLbsN068Vj +SNkayEgoT9hgHtqFSS9w+TAOl7aRtSa1NaWNy0A6Mmfv+lcgVOEe4e3gVAXGGBooR nVPOFSatPalRk6kx1x7iRgoztthlCs0sLriVrI4EAyyZYh7nRKm1zqU/+CwUHs1q7x 50RCXWddmi1nA== Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AIJ0FeB028420 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 18 Nov 2026 22:00:15 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AIJ0FeB028420 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="SgjWgH7l" Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-4a589b28bddso740736f8f.0 for ; Wed, 18 Nov 2026 11:00:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFOEAjtQ7SfwCuDQqrb26JUh4pZHRGXSMpG/at3ZXtNNSCImzRo3RF/MKetAMJLoNT3O9uNFw==@openvz.org X-Gm-Message-State: APuU4Z9GW3gMaVM79IALAi7ZRQZhiE1/oHzN/J+4VMGHldhmaG3rT9WD nVqK66Yz8BgZcK9TJBNMpVxX7Gb5SCMbID68ugwcqNqiBiqJB/Gvgf1ACA1x0UQbRmDsWRAdJ9y DrY57smb/z5rPtYbwzwq/htdPm3FBK61DTH1wh1LKXvQ8pCM0m68HAg== X-Gm-Gg: AYBFou1V4dHnt5lEb3fjtY2GHalhobdpDG+yZuKnv1UD8IShg6DGkef+ey1jy+kjSOj TVPRjJcgUFdFt4q1O/xulnKAYhy1R9WebuCNx1g7oZkeL2RrzLK91UYhrm5CRXk4P885CMOLGZp evEyfxemcfgOmRe9kOe6r4T8c5wP95Venq5NBBwG3iIVqD7k4a8iEoUx6dD83EbwcI1TYdrecIV o2XZDpAEWTdrer5olGGiVi6iDzEnHWBr3ZFywNjqqSC3I5LBthYzjloK5kTYhbhDSqga6f8j09m vW9Oes/B7Q== X-Received: by 2002:a05:600c:548d:b0:4bb:68b9:f615 with SMTP id 5b1f17b1804b1-4bb7da1c132mr75079175e9.17.1795028410324; Wed, 18 Nov 2026 11:00:10 -0800 (PST) X-Received: by 2002:a05:600c:548d:b0:4bb:68b9:f615 with SMTP id 5b1f17b1804b1-4bb7da1c132mr75078515e9.17.1795028409754; Wed, 18 Nov 2026 11:00:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795028409; cv=none; d=google.com; s=arc-20260327; b=CuxHw08mKNcD/hUVNZjUHJkHFLNAg+dQvSoLnpNIqxH9xc8s7DrnBpxceHgWOp/NC8 mSpWSUj6fvjLJnJhWJKxT2oY2aIW49MPKyw8XkO+Dkk+Z81ZoIRNOU2MS+csd6+6A8Op G3pYbgk9frV+FrUnDfjzCoOgvwZRWS0q95/RdCQ7g6cF7cHWYiv4dgIZ9d1FT47m+1xv 30+XaywLukpVfAJIMQpJyLuC0csjeYmxuXDnZGDE6BIFp4RwZJ+1m14A/Y4s4NxSWh1z NR0t3MNcJnZ929JER35h+3MOYX7ggp0VFdoXPKrX13Xd7PoaEHQD43AvWo6nCLlFbiNW 112g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=vVXW4ACdR6vy/FOcljvS3aN2qihgfr/xcTsLdSOWU4c=; fh=m5DOXi+Lk16bvHGs2sJ7PbMIzMemmBYcYLB+mVU7sVI=; b=ccXWK7AaIgTCgZ6XWzPoI2MUQCnMllKQ/bs2GzFV781f3iaTc6eYXjiAYf5hGJFk5B WxIxIf6SLm1camkfX8vfd29CwsqUTVl/3yXZQelCWwMvl6gHx/92QxmP6UUiDTg11aMg tiB2YAW/X7fK9DbBBRzOin0dvtbJyYlJ9Qe0ScGwx7pS4EEcdSamCnvuEt/voA1fIPNQ svc1tN47cmH77K9qKiaWqfG3wTlB5KhNke785iuN6OEZ04717+fR35b9jvu8qgCWTtAN Gq5pcuV5zwIw/k2yNkVANUwRStQLzIb+ovSzSELSYGqm6qUJbrrTZ2QNMKQpnztk3rrz UaQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=SgjWgH7l; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4bb7d24231fsor8207905e9.0.2026.11.18.11.00.09 for (Google Transport Security); Wed, 18 Nov 2026 11:00:09 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) client-ip=2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=SgjWgH7l; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1795028409; x=1795633209; darn=openvz.org; 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=vVXW4ACdR6vy/FOcljvS3aN2qihgfr/xcTsLdSOWU4c=; b=SgjWgH7lvXYJjXkNYL4mv+rBk/XP5mHFn5KxGNBMhQXT5mHwQmib7XAdNqfif4hcF6 dFWAmzYT1ORtzsfSGzVsIaiAWbKImpXea2z0loccXAoc1AOKzfBz0m+jzTyF+D9NKEri 0V88OFecaiBCT5MQSckcO8z/Ci8Wtzh0QMJe1DZlsyFUl9vhU/z/18K81RNfkRnTYSFt 22anFKbVHu2sxATXk9la3sEyJXJdnLjivolTbl8i6tMYmS547wouV16HSJFqREj2gj/D PkGmVJMd9c31ElOJEbUO8y7bkHGRpjebXpGjIozirlzsesSeDwj4+K/xmhMRAamOGtyz 9kOg== X-Forwarded-Encrypted: i=1; AL+hErGW0q2JL14p9ikII2nwUnQm0QOf/UqUM3WBEdX3o/NlMzrnbjw4SAavI1nBFBszxJlDMoW+8Q==@openvz.org X-Received: by 2002:a05:600c:4fc6:b0:4bb:6823:3d3c with SMTP id 5b1f17b1804b1-4bb7da26fc7mr73044095e9.20.1795028409251; Wed, 18 Nov 2026 11:00:09 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8328facdsm10953505e9.10.2026.11.18.11.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 11:00:08 -0800 (PST) From: "Denis V. Lunev" To: alexander.ivanov@virtuozzo.com, vasileios.almpanis@virtuozzo.com Date: Wed, 18 Nov 2026 20:00:06 +0100 Message-ID: <20261118190006.3573492-1-den@openvz.org> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [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 From: Denis V. Lunev ploop_try_delay_enospc() tests wants_suspend and adds the pio to enospc_pios without deferred_lock, then arms enospc_timer and queues event_work. Nothing keeps the struct ploop alive once the pio is on the list. An endio that stalls after llist_add() can see ploop_presuspend() set wants_suspend and resubmit the pio, the retry fail and complete the request, and the device go away. The endio then calls mod_timer() and schedule_work() on the freed struct ploop. timer_shutdown_sync() and cancel_work_sync() in ploop_destroy() cannot close that, as the endio writes into the freed memory itself. 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. https://virtuozzo.atlassian.net/browse/VSTOR-154847 Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver") Feature: dm-ploop: ploop target driver Signed-off-by: Denis V. Lunev --- Tested with an injected delay after llist_add() and the device suspended and removed while the endio is held: the stock module oopses in lock_timer_base() on the poisoned timer, the patched one makes the suspend wait for the lock and stays clean. drivers/md/dm-ploop-map.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c index 58d1c7092602..c62b414862b1 100644 --- a/drivers/md/dm-ploop-map.c +++ b/drivers/md/dm-ploop-map.c @@ -182,7 +182,9 @@ static bool ploop_try_delay_enospc(struct ploop_rq *prq, struct pio *pio) struct ploop *ploop = pio->ploop; unsigned long flags; + spin_lock_irqsave(&ploop->deferred_lock, flags); if (unlikely(ploop->wants_suspend)) { + spin_unlock_irqrestore(&ploop->deferred_lock, flags); PL_WARN("dropping pio enospc\n"); return false; } @@ -191,13 +193,12 @@ static bool ploop_try_delay_enospc(struct ploop_rq *prq, struct pio *pio) pr_err_once(PL_FMT("underlying disk is almost full"), ploop_device_name(ploop)); - spin_lock_irqsave(&ploop->deferred_lock, flags); ploop->event_enospc = true; - spin_unlock_irqrestore(&ploop->deferred_lock, flags); llist_add((struct llist_node *)(&pio->list), &ploop->enospc_pios); mod_timer(&ploop->enospc_timer, jiffies + PLOOP_ENOSPC_TIMEOUT); schedule_work(&ploop->event_work); + spin_unlock_irqrestore(&ploop->deferred_lock, flags); return true; } -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel