From nobody Sat Sep 26 20:51:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1788288101; cv=none; d=zohomail.com; s=zohoarc; b=P0bEO+jOrWatcG2zRtHSFyHZb2deu5rextrppXwE6lHksJ0/fnRRloAekjScWE83VLmUsx6Q5JOsa3i1UQh8FhBzy1QG3u67GxEl/k8Gr7vgTAjA56qw7zDJ6uwlwjNhTDEUTLDaU2CXH+d5ietM7sAsX4oCmIC8Urd7kvZtvvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788288101; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EL/B7zBD0Qp4v2yATtywqiaHdynhOiy6CLDynKAMTOY=; b=NU+twhQZlQaJ+JSUPSr9XHDw5KGt60h1n9LQawQT9lncEZJabLWLdeNl4Zlcqw7MLn1paW4EymY63d9V/0VvUYITvLMz8pMM8vXB21ogZoMhsTwkjTUpO0tYsE3vOj0J00Zb3jK+l/iQxyJItr1/W3tbYDBb/ox2MCNYwBDZ9QI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788288101310237.2894763007448; Tue, 1 Sep 2026 11:41:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1TPv-0001Rk-EA; Tue, 01 Sep 2026 14:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1TPl-0001NL-D5 for qemu-devel@nongnu.org; Tue, 01 Sep 2026 14:40:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1TPj-0006Hu-0K for qemu-devel@nongnu.org; Tue, 01 Sep 2026 14:40:56 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-xcrdmZjZO1KX2g4-OYoueQ-1; Tue, 01 Sept 2026 14:40:48 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2D6D51801318; Tue, 1 Sep 2026 18:40:47 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 549DC1955F72; Tue, 1 Sep 2026 18:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788288054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EL/B7zBD0Qp4v2yATtywqiaHdynhOiy6CLDynKAMTOY=; b=b3Fzu20QMBUG29sjrh/Nc4NdA25aMuf257So7R/adJzjMYLPwa85652YVuYlsGeqTqyxuG 2P1+yMHHzHXQ1yghb3Rj66Mnj4Lf9fTknwQz4gOgOvC5qOBkSLxRbKw3scar8PQ4IL/lxl kMxh5bQ0H+7Yq4ikTNAgspnL5rvYqqk= X-MC-Unique: xcrdmZjZO1KX2g4-OYoueQ-1 X-Mimecast-MFC-AGG-ID: xcrdmZjZO1KX2g4-OYoueQ_1788288047 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Zhao Liu , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, Paolo Bonzini , Richard Henderson , Stefan Hajnoczi , Niklas Cassel , Damien Le Moal , Dmitry Fomichev , Johannes Thumshirn Subject: [PULL 1/3] file-posix: fix cache.direct=on check for zoned block devices Date: Tue, 1 Sep 2026 14:40:40 -0400 Message-ID: <20260901184043.728292-2-stefanha@redhat.com> In-Reply-To: <20260901184043.728292-1-stefanha@redhat.com> References: <20260901184043.728292-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1788288104953154100 Content-Type: text/plain; charset="utf-8" From: Niklas Cassel For zoned block devices with SWR zones, the order of the writes must be maintained to avoid write not at write pointer errors. Thus, cache.direct=3Don must be used to bypass the page cache, since the page cache uses write-back caching, where the physical order of the writes is not guaranteed. There is already a check for cache.direct=3Don in raw_open_common(), however, this check is done before raw_refresh_zoned_limits() has been called (which initializes bs->bl.zoned), so it is currently dead code. Fix this by moving the check to raw_refresh_zoned_limits(), such that the check is done after bs->bl.zoned has been initialized. Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev Fixes: 774c726ceb2a ("block: add zoned BlockDriver check to block layer") Signed-off-by: Niklas Cassel Reviewed-by: Stefan Hajnoczi Reviewed-by: Johannes Thumshirn Message-ID: <20260617133658.2022750-1-cassel@kernel.org> Signed-off-by: Stefan Hajnoczi --- block/file-posix.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 3c985da94f5..01037f4b5c3 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -793,18 +793,6 @@ static int raw_open_common(BlockDriverState *bs, QDict= *options, goto fail; } } -#ifdef CONFIG_BLKZONED - /* - * The kernel page cache does not reliably work for writes to SWR zones - * of zoned block device because it can not guarantee the order of wri= tes. - */ - if ((bs->bl.zoned !=3D BLK_Z_NONE) && - (!(s->open_flags & O_DIRECT))) { - error_setg(errp, "The driver supports zoned devices, and it requir= es " - "cache.direct=3Don, which was not specified."); - return -EINVAL; /* No host kernel page cache */ - } -#endif =20 #ifdef __FreeBSD__ if (S_ISCHR(st.st_mode)) { @@ -1455,6 +1443,16 @@ static void raw_refresh_zoned_limits(BlockDriverStat= e *bs, struct stat *st, } bs->bl.zoned =3D zoned; =20 + /* + * The kernel page cache does not reliably work for writes to SWR zone= s of + * zoned block devices because it can not guarantee the order of write= s. + */ + if (!(s->open_flags & O_DIRECT)) { + error_setg(errp, "The driver supports zoned devices, and it requir= es " + "cache.direct=3Don, which was not specified."); + goto no_zoned; + } + ret =3D get_sysfs_long_val(st, "max_open_zones"); if (ret >=3D 0) { bs->bl.max_open_zones =3D ret; --=20 2.55.0 From nobody Sat Sep 26 20:51:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1788288100; cv=none; d=zohomail.com; s=zohoarc; b=fKKDdQsTJZXDPk045zx5s2VzgYa3pt1yHFje3eKCg8q5njmTnfsJB0VhPh88UyragLbNjdHM164K/c1j2YOiA1ua3O1VtFnL7+M69JEiKF0jdeWQqYLpnJAjhezyDENZu8QKVUD2JI0HidRTHuS0aU3r2y0s/hs35TMpzNx1NlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788288100; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x7gMk7Rx10faxz3GbDzvUynoW3hAOa9Huij7TUgeAkM=; b=Nx6IP+vmq/dAUMrYkNvHLSce4CWPTcq+V75M6aIdZtFTIluzhzEdtaH0CtiLtsc2VgNQBtb1jgGScTa5gPQkKsWUBpf+JYRsv5pHGuWkVlZMrQMZAC+rn06vLZs37OIDg1o83T4ZL/5VKHeaW137WEkAAniipqofOIXJNlxQ4CQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788288100280288.70807152668976; Tue, 1 Sep 2026 11:41:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1TPu-0001Qt-Ty; Tue, 01 Sep 2026 14:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1TPj-0001N0-Ki for qemu-devel@nongnu.org; Tue, 01 Sep 2026 14:40:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1TPi-0006Hd-1g for qemu-devel@nongnu.org; Tue, 01 Sep 2026 14:40:55 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-294-jb7IUpCFOqeGqMnf3aZZRQ-1; Tue, 01 Sept 2026 14:40:52 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DC1A018052F9; Tue, 1 Sep 2026 18:40:49 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 824BE18005B8; Tue, 1 Sep 2026 18:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788288053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x7gMk7Rx10faxz3GbDzvUynoW3hAOa9Huij7TUgeAkM=; b=JxORQIGATPE9NmU8UK1MhuCCGHkb7rn2H0nqETRfC8v03wtZ7vPvBLtYKMPuUO9pJ3OJqQ qI4bfN4iQeHIc/r7kxHhZ6dNOZCPwNIVS/F8sfCZ/cjNqETZlm5qmWf79RVV968QnV2usE 5uiWWKZEEbbX5pZ+iEyfIh4yco2UdLQ= X-MC-Unique: jb7IUpCFOqeGqMnf3aZZRQ-1 X-Mimecast-MFC-AGG-ID: jb7IUpCFOqeGqMnf3aZZRQ_1788288050 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Zhao Liu , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, Paolo Bonzini , Richard Henderson , Stefan Hajnoczi , Daniil Tatianin , Vladimir Sementsov-Ogievskiy Subject: [PULL 2/3] tests/../test_hotplug_blk: drop unused nic Date: Tue, 1 Sep 2026 14:40:41 -0400 Message-ID: <20260901184043.728292-3-stefanha@redhat.com> In-Reply-To: <20260901184043.728292-1-stefanha@redhat.com> References: <20260901184043.728292-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1788288103050154100 Content-Type: text/plain; charset="utf-8" From: Daniil Tatianin The test doesn't need any networking, so drop the net card. Also the test will break if at some moment q35 aliase refers to machine type with default virtio-net nic, which will clash with virtio-blk in the test, and self.wait_for_console_pattern('virtio_blk virtio0: [vda]') will not work. Let's make the test a bit more resistant to experiments with machine type. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-ID: <20260629201332.1001055-1-vsementsov@yandex-team.ru> Signed-off-by: Stefan Hajnoczi --- tests/functional/x86_64/test_hotplug_blk.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/x86_64/test_hotplug_blk.py b/tests/functional= /x86_64/test_hotplug_blk.py index 7ddbfefc210..a9b43fe2e91 100755 --- a/tests/functional/x86_64/test_hotplug_blk.py +++ b/tests/functional/x86_64/test_hotplug_blk.py @@ -66,6 +66,7 @@ def test(self) -> None: self.set_machine('q35') =20 self.vm.add_args('-accel', 'kvm') + self.vm.add_args("-nic", "none") # avoid creating default nic self.vm.add_args('-device', 'pcie-pci-bridge,id=3Dpci.1,bus=3Dpcie= .0') self.vm.add_args('-m', '1G') self.vm.add_args('-append', 'console=3DttyS0 rd.rescue') --=20 2.55.0 From nobody Sat Sep 26 20:51:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1788288092; cv=none; d=zohomail.com; s=zohoarc; b=a3G+gXHU3Gca6xVnsXcXe5zUiRL/OEc3gywSY14me0Tu1nCSoz/6cjnIcbuMa/O9RaArkKDFOUnu8fBFE3kOphyIn21bx7KgFkel5fWkmtCOjIRgmSwomJIm7Ok6F3xmSSiqWgXM9mm6ZHR9J4YM4UiBmSVnkAZbo3AIaT9PZno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788288092; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zVmsdH6szw+OzI1T7/k++XjaIUl4aN50H4QCNN8iNw4=; b=eFzHVtZWNTos2f43xevBjerqyOQjLxt/0z5DuC3A7TAJiSOKUT6neVhnk87tMI4iIW1b7WDxAYH9wN7Dy/5F896kqAgUBeTjsNi5GcXiSjqVbEIY6pTpCeSccqeuQzfkb/khzcPREKGaQqtseO1wA6gf8BW3mQ8br5Q8rMKxgh0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1788288092722288.9208356519231; Tue, 1 Sep 2026 11:41:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x1TPw-0001SI-Cl; Tue, 01 Sep 2026 14:41:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1TPn-0001OB-D7 for qemu-devel@nongnu.org; Tue, 01 Sep 2026 14:41:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x1TPl-0006K0-8Q for qemu-devel@nongnu.org; Tue, 01 Sep 2026 14:40:58 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-CWZZwfKzPoiTR_tpFK0OZg-1; Tue, 01 Sept 2026 14:40:53 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1296F180AEE1; Tue, 1 Sep 2026 18:40:52 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 36A201803A67; Tue, 1 Sep 2026 18:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788288056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zVmsdH6szw+OzI1T7/k++XjaIUl4aN50H4QCNN8iNw4=; b=h0L3trIwqHGMSsIVKcbBuTl0m+Jo336AqKAAf3TrwxATqPv/pl/RY1FyxFa/nARYwcoJZ5 LOX5qUTzYMpzfMej+cuKD6Nxm17wDr25Wc06yIK27fZVJXy2HpQpYD5YQ1G2V6FkASnzHM N9Slc7HjMLl803licvYv6F8xq9j04js= X-MC-Unique: CWZZwfKzPoiTR_tpFK0OZg-1 X-Mimecast-MFC-AGG-ID: CWZZwfKzPoiTR_tpFK0OZg_1788288052 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Zhao Liu , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, Paolo Bonzini , Richard Henderson , Stefan Hajnoczi , Niklas Cassel , Damien Le Moal Subject: [PULL 3/3] file-posix: fix zone write granularity assignment for zoned block devices Date: Tue, 1 Sep 2026 14:40:42 -0400 Message-ID: <20260901184043.728292-4-stefanha@redhat.com> In-Reply-To: <20260901184043.728292-1-stefanha@redhat.com> References: <20260901184043.728292-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1788288094745154100 Content-Type: text/plain; charset="utf-8" From: Niklas Cassel In the ZBC and ZAC specifications, the requirement is that the write granularity matches the physical block size. However, in the ZNS specification, the requirement is simply that the write granularity matches the logical block size. See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3Da805a4fa4fa376bbc145762bb8b09caa2fa8af48 In Linux, there is a zone_write_granularity sysfs property which abstracts this away, so let's make use of it. Currently, it is theoretically possible that QEMU presents an inflated write granularity for NVMe devices where the physical block size is larger than the logical block size. Reviewed-by: Damien Le Moal Fixes: a3c41f06d5a8 ("file-posix: add tracking of the zone write pointers") Signed-off-by: Niklas Cassel Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 01037f4b5c3..9aad156aad4 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1493,7 +1493,7 @@ static void raw_refresh_zoned_limits(BlockDriverState= *bs, struct stat *st, bs->bl.max_append_sectors =3D ret >> BDRV_SECTOR_BITS; } =20 - ret =3D get_sysfs_long_val(st, "physical_block_size"); + ret =3D get_sysfs_long_val(st, "zone_write_granularity"); if (ret >=3D 0) { bs->bl.write_granularity =3D ret; } --=20 2.55.0