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 14BAD80069 for ; Thu, 19 Nov 2026 12:52:48 +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 6AJCpaPt031134; Thu, 19 Nov 2026 15:51:36 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJCpaPt031134 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1795092699; bh=gcsMRICh3ewhSIx8O9GOy4vSRKd+HYajO4kdWi9/0lA=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=E2lLPeXnLT842gVBW1ZDTl1r6j4034IShy1ecOYew8ulLi/UIndk+W7KUq3NB1upd UavWXbXkgbjjD8WcpXrtuAr8J793zXXvxPL+XNqpjMcaT6U3kJTLyWpOH1zxnI9rBK K1dqMR6c4eNu2XV8mfLIQtgNhRJ1V/Pe/0vfJdmaPlqFcZFEtRuc2nphpxDNY/HwuW yuzDKbBtzxojlZ8pScajGBM00yF+gPCw9LE/+WlR+F7VEEX/twT/QJFd2UGikCXedx y3co3+6f/p/rHmP/mQe3v5EX8EHQTvSgTr9Yn6VbMSRBMJQ5pPHt5l4r7BkrH1HYOQ 1+RVMQ6uODGCg== Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AJCpRBw031100 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 19 Nov 2026 15:51:28 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJCpRBw031100 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="fxAfPWgQ" Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4aae099f5baso99263f8f.1 for ; Thu, 19 Nov 2026 04:51:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHDe1KOH/wYO2+vpB/0UxxjYFCHdv7IN85kXA6cGqgJhzX29hjaAkp1Shw4hIGQ+X1ruXAI4g==@openvz.org X-Gm-Message-State: APuU4Z+guMqsTHcXYh8EKhgM7Bec96bdlcS7aHnnV+J2knKbc9k6rAmX oB+tDp1MvjmLLkMXqMrxES/Ozz9Gl2biKry4PsG2utzp4OvHMpdLYX2+b0S80Va9GexvZlMwom6 EWbyYynQrxtlrK8wDwt3QZPqR23oc+E/Jj0LY1B4rrtciN2YKnidMJQ== X-Gm-Gg: AYBFou1K9fG12AEPSrgQSAdfM9FbhagINuCuvyeZN5erkXTpzVepr1PBnoDvQ+nlhCI DC/S52J7AtUGSq/r4uild8IztfygF4Jk4qcyC3s2bYhQhAA2wK2aManDo7Dd1naUTdRhjsokhpu i5jvAoskIcx8y6qAUOPUz1MRwBLtHCB2CEVoGctFQtzOxTS3rSnrogAbd19vuluYlpdCXldLj6O bW3EsKvyST0KFFlPfw9hv+w+oHgCAzsTNICwNFhgnDYfhk/o+wbZvtYvpPiR+skXyba2eI9njA3 uSXRl6hGlA== X-Received: by 2002:a05:600c:4f4f:b0:4a1:f377:5c6c with SMTP id 5b1f17b1804b1-4bb7da1274dmr118264355e9.10.1795092687603; Thu, 19 Nov 2026 04:51:27 -0800 (PST) X-Received: by 2002:a05:600c:4f4f:b0:4a1:f377:5c6c with SMTP id 5b1f17b1804b1-4bb7da1274dmr118263595e9.10.1795092686907; Thu, 19 Nov 2026 04:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795092686; cv=none; d=google.com; s=arc-20260327; b=MJKfWR/IxbZPiD5TMCXBXC+p18mESI81Nak9OLNC4+W6YbFEc7JLSgKNb8XJqSCeQj RrNdC7wqVo4L7XIDZihJhrOckE3JZNT0PhPyaSY9O8qhKHCJXATItWQDkhMF2229CIRS UJGpcQ15XOyuCtVKRj/TeTNgPtaPpE2+Sk1yZ+B6Le2Ufu+pOSh4W+nPCvBAFhHSdvxq ChlXss5+6RotflLNS2yCJX3yVdCJ16UhljS9vnZvWs4X5dIRNswTxKN7iXVC1OIPmJqD qEmEJ9XMKcez0I3KFJPo3K4nY9b0dcMRXCM16jniT9KQv7Dsms5+yvphGB6F39pmlwtq 56PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=SkO7ubEDU2EW6K1Ei6PxH5c4Yhbryh3vuSGKkBksk/A=; fh=saaupDmS6LbJbexOFaz+PuZm8Xhos/WmHuuHaYqsizc=; b=WfMM6uMD4Zp3HT4IbQJR6cbmOgiGMadk1bunWEA14RiWM1izFW8q0v0C/ZJRZsSgcE 5mFMfa5qguIuPOZEWG0PQhkZYztAE7WiDAWpp1wTRCgs4lAzlWyJnVF7mDpIMzt2p8Be my9bRob7b3U35uybDzB101/Hmr/mQkrgxMiz52f0QQio2EQsWLZ+M/JV3M+70aN1Gw34 gqLhwjb2gVOG4NLp6/9kRrjJDn0ri/shNSy3z5AfCDhw9Acz/uE4szkBmAO0gLT2d4nO X9WmrknIEvtu3xl+GGomLzCoAE+Hongv1FmDWmyduFhbC5pVulZy4C0GtRDc4GuAV90w 25aw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=fxAfPWgQ; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:989f:a206:d03d:c3d5 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-4bb7de8091dsor8656515e9.4.2026.11.19.04.51.26 for (Google Transport Security); Thu, 19 Nov 2026 04:51:26 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:989f:a206:d03d:c3d5 as permitted sender) client-ip=2a06:5b06:b600:300:989f:a206:d03d:c3d5; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=fxAfPWgQ; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:989f:a206:d03d:c3d5 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=1795092686; x=1795697486; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SkO7ubEDU2EW6K1Ei6PxH5c4Yhbryh3vuSGKkBksk/A=; b=fxAfPWgQ6H11jS7t6nSF0hfKVLEnuJo4wuRbjQSxWBK28ve8CbuuUN4rl1riXM9jAt j+RVVFS7yafCj07Behi4JTzSr36RJ9rG1m+9sRWM7sNZPKmAsNW6ojXeelPsmvWNKptV HCpsvQw9b0mLZIRQefReMUSmRaQUNLM7RLMy0Wk/Nm8uoXjpdDv/1ymBw/iVR21R8HbO z+qGRzm5bKVUjQvpnes+H7sES5ksS0WHi8djRi0zBSzfdJ+QdKG4G36Jx4ifSj2WuSNf zmFMPmbtciS6URMvWXGZ4UH746GXEUCMqE4ppllqobMwZRsZyV1y65etIYZja7wnU7RF cGrQ== X-Forwarded-Encrypted: i=1; AL+hErFWRTNPUY+BXkPW3Os5ZD5SSnmYHCFtYEg8Oe9H/H+Nrcl9piWxA5rfAKwQDPzB7AbywTfnNQ==@openvz.org X-Received: by 2002:a05:600c:3107:b0:4ba:eb:eb9b with SMTP id 5b1f17b1804b1-4bb7da1272cmr115448855e9.8.1795092686350; Thu, 19 Nov 2026 04:51:26 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:989f:a206:d03d:c3d5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb84e804d2sm30591395e9.5.2026.11.19.04.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 04:51:26 -0800 (PST) From: "Denis V. Lunev" To: alexander.ivanov@virtuozzo.com, vasileios.almpanis@virtuozzo.com Date: Thu, 19 Nov 2026 13:51:21 +0100 Message-ID: <20261119125121.861804-3-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261119125121.861804-1-den@openvz.org> References: <20261119125121.861804-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 2/2] dm-qcow2: fix a read livelock at EOF of a read-only image 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 submit_read_compressed() reads a compressed cluster up to a page boundary, and qcow2_parse_header() pads the file to a page only when the image is writable. On a read-only image whose file ends mid-page on a sector boundary, as qemu-img convert -c leaves a lower image, that read runs past EOF and comes back short. data_rw_complete() takes the short read for partial I/O and resubmits the rest. The resubmit starts at EOF, reads 0 bytes, trips WARN_ON_ONCE(qio->ret == 0) in data_rw_complete() and is resubmitted forever. The worker spins, and the first reader of the device, usually udev or partprobe at mount, never returns. Accept a short read that ends at EOF of a read-only image less than a page short, the padding such an image lacks, and zero the rest, as md_page_read_complete() does for metadata. The zeroing runs in the I/O completion, which the previous patch made safe. End a read that returns 0 bytes with -EIO instead of resubmitting it, which also covers an L2 entry that points at or past EOF. https://virtuozzo.atlassian.net/browse/VSTOR-155987 Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files") Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Denis V. Lunev --- drivers/md/dm-qcow2-map.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index c7e186fa6115..cf66b9a98085 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -3012,13 +3012,21 @@ static void data_rw_complete(struct qio *qio) unsigned long flags; if (unlikely(qio->ret != qio->bi_iter.bi_size)) { - if (qio->ret >= 0) { + if (!write && qio->ret > 0 && !qcow2_file_is_writable(qcow2) && + to_bytes(qio->bi_iter.bi_sector) + qio->ret == qcow2->file_size && + qio->bi_iter.bi_size - qio->ret < PAGE_SIZE) { + /* Read near EOF, same as md_page_read_complete() */ + zero_fill_qio(qio, qio->ret, qio->bi_iter.bi_size - qio->ret); + } else if (!write && qio->ret == 0) { + bi_status = BLK_STS_IOERR; + } else if (qio->ret >= 0) { WARN_ON_ONCE(qio->ret == 0); qio_advance(qio, qio->ret); qcow2_queue_resubmit(qio); return; + } else { + bi_status = errno_to_blk_status(qio->ret); } - bi_status = errno_to_blk_status(qio->ret); } if (qio->writer_md) -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel