public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	Keith Busch <keith.busch@wdc.com>,
	dm-devel@lists.linux.dev, Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, linux-xfs@vger.kernel.org,
	Carlos Maiolino <cem@kernel.org>,
	linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>
Subject: Re: [PATCH v3 00/15] Introduce cached report zones
Date: Wed, 5 Nov 2025 05:59:51 +0900	[thread overview]
Message-ID: <9f899cd8-7187-4878-b294-337d964c9587@kernel.org> (raw)
In-Reply-To: <20251104144158.GA27416@lst.de>

On 11/4/25 23:41, Christoph Hellwig wrote:
> I just threw this into my xfstests setup, and it seems this version
> is broken somehow.  Running on emulated ZNS devices with XFS I get
> a lot of failures with warnings like this:
> 
> [   30.068652] XFS (nvme1n1): empty zone 1 has non-zero used counter (0x1).
> 
> [   49.316873] XFS (nvme0n1): empty zone 2 has non-zero used counter (0x10).
> 
> so it seems like it's not tracking WPs correctly, probably when using
> zone append and unmount/remounting.

Aouch ! I totally missed that !

First problem, trivial, I am missing this in the xfs patch:

diff --git a/fs/xfs/libxfs/xfs_zones.c b/fs/xfs/libxfs/xfs_zones.c
index b0791a71931c..b40f71f878b5 100644
--- a/fs/xfs/libxfs/xfs_zones.c
+++ b/fs/xfs/libxfs/xfs_zones.c
@@ -95,6 +95,7 @@ xfs_zone_validate_seq(
        case BLK_ZONE_COND_IMP_OPEN:
        case BLK_ZONE_COND_EXP_OPEN:
        case BLK_ZONE_COND_CLOSED:
+       case BLK_ZONE_COND_ACTIVE:
                return xfs_zone_validate_wp(zone, rtg, write_pointer);
        case BLK_ZONE_COND_FULL:
                return xfs_zone_validate_full(zone, rtg, write_pointer);

Second problem is a little more subtle: when disk_insert_zone_wplug() is called
from blk_revalidate_disk_zones() callback for a non empty zone, the zone
condition is set to BLK_ZONE_COND_NOT_WP if we do not have a disk zones_cond
array. But we never have that on the first call to blk_revalidate_disk_zones()
since that function sets it at the end of the revalidation. So we need this
change to also avoid mount errors after a reboot for an FS with partially
written zones:

 diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index bf6495f0d49f..bba64b427082 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -527,12 +527,20 @@ static bool disk_insert_zone_wplug(struct gendisk *disk,
                        return false;
                }
        }
+
+       /*
+        * Set the zone condition: if we do not yet have a zones_cond array
+        * attached to the disk, then this is a zone write plug insert from the
+        * first call to blk_revalidate_disk_zones(), in which case the zone is
+        * necessarilly in the active condition.
+        */
        zones_cond = rcu_dereference_check(disk->zones_cond,
                                lockdep_is_held(&disk->zone_wplugs_lock));
        if (zones_cond)
                zwplug->cond = zones_cond[zwplug->zone_no];
        else
-               zwplug->cond = BLK_ZONE_COND_NOT_WP;
+               zwplug->cond = BLK_ZONE_COND_ACTIVE;
+
        hlist_add_head_rcu(&zwplug->node, &disk->zone_wplugs_hash[idx]);
        atomic_inc(&disk->nr_zone_wplugs);
        spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);

I will integrate these fixes in v5 and resend.




-- 
Damien Le Moal
Western Digital Research


      reply	other threads:[~2025-11-04 21:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04  1:31 [PATCH v3 00/15] Introduce cached report zones Damien Le Moal
2025-11-04  1:31 ` [PATCH v3 01/15] block: handle zone management operations completions Damien Le Moal
2025-11-04  4:04   ` Chaitanya Kulkarni
2025-11-04 17:53   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 02/15] block: freeze queue when updating zone resources Damien Le Moal
2025-11-04  4:04   ` Chaitanya Kulkarni
2025-11-04 17:56   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 03/15] block: cleanup blkdev_report_zones() Damien Le Moal
2025-11-04  4:04   ` Chaitanya Kulkarni
2025-11-04  1:31 ` [PATCH v3 04/15] block: introduce disk_report_zone() Damien Le Moal
2025-11-04  4:05   ` Chaitanya Kulkarni
2025-11-04 19:39   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 05/15] block: reorganize struct blk_zone_wplug Damien Le Moal
2025-11-04  4:05   ` Chaitanya Kulkarni
2025-11-05  7:02   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 06/15] block: use zone condition to determine conventional zones Damien Le Moal
2025-11-04  4:05   ` Chaitanya Kulkarni
2025-11-05  7:04   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 07/15] block: track zone conditions Damien Le Moal
2025-11-04  4:08   ` Chaitanya Kulkarni
2025-11-05  7:06   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 08/15] block: refactor blkdev_report_zones() code Damien Le Moal
2025-11-04  4:09   ` Chaitanya Kulkarni
2025-11-05  7:07   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 09/15] block: introduce blkdev_get_zone_info() Damien Le Moal
2025-11-04  4:10   ` Chaitanya Kulkarni
2025-11-05  7:09   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 10/15] block: introduce blkdev_report_zones_cached() Damien Le Moal
2025-11-04  4:11   ` Chaitanya Kulkarni
2025-11-05  7:10   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 11/15] block: introduce BLKREPORTZONESV2 ioctl Damien Le Moal
2025-11-04  4:12   ` Chaitanya Kulkarni
2025-11-04 19:00   ` Bart Van Assche
2025-11-04 20:13     ` Damien Le Moal
2025-11-04 20:36       ` Bart Van Assche
2025-11-05  7:11   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 12/15] block: improve zone_wplugs debugfs attribute output Damien Le Moal
2025-11-04  4:13   ` Chaitanya Kulkarni
2025-11-05  7:11   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 13/15] block: add zone write plug condition to debugfs zone_wplugs Damien Le Moal
2025-11-04  4:15   ` Chaitanya Kulkarni
2025-11-04  7:37   ` Johannes Thumshirn
2025-11-05  7:12   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 14/15] btrfs: use blkdev_report_zones_cached() Damien Le Moal
2025-11-05  7:13   ` Hannes Reinecke
2025-11-04  1:31 ` [PATCH v3 15/15] xfs: " Damien Le Moal
2025-11-04  4:15   ` Chaitanya Kulkarni
2025-11-05  7:14   ` Hannes Reinecke
2025-11-04 14:41 ` [PATCH v3 00/15] Introduce cached report zones Christoph Hellwig
2025-11-04 20:59   ` Damien Le Moal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f899cd8-7187-4878-b294-337d964c9587@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cem@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=keith.busch@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox