All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v8 06/12] zloop: fix zone reporting consistency
Date: Mon, 09 Nov 2026 10:06:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-204780@kernel.org> (raw)
In-Reply-To: <20261109095144.819709-7-dlemoal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] zloop: inconsistent empty zone report in zloop_report_zones()
--

commit 2a1f79e0caf4e50f76c7d14b20ef44343010c188
Author: Damien Le Moal <dlemoal@kernel.org>

zloop: fix zone reporting consistency

This commit moves the read of zone->cond inside zone->wp_lock in
zloop_report_zones() so that blkz.wp and blkz.cond are populated while
holding the same spinlock.

> diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
> index 65634a39b0bfc..e1ad7513fea9b 100644
> --- a/drivers/block/zloop.c
> +++ b/drivers/block/zloop.c
> @@ -992,8 +992,8 @@ static int zloop_report_zones(struct gendisk *disk, sector_t sector,
>  		blkz.len = zlo->zone_size;
>  		spin_lock(&zone->wp_lock);
>  		blkz.wp = zone->wp;
> -		spin_unlock(&zone->wp_lock);
>  		blkz.cond = zone->cond;
> +		spin_unlock(&zone->wp_lock);
>  		if (test_bit(ZLOOP_ZONE_CONV, &zone->flags)) {
>  			blkz.type = BLK_ZONE_TYPE_CONVENTIONAL;
>  			blkz.capacity = zlo->zone_size;

[Severity: Medium]
Can zloop_report_zones() still report blkz.cond == BLK_ZONE_COND_EMPTY
with blkz.wp > blkz.start when ordered_zone_append is enabled?

When a zone append to an empty zone does not fill the zone,
zloop_set_zone_append_sector() advances zone->wp under zone->wp_lock,
while transitioning zone->cond to BLK_ZONE_COND_IMP_OPEN via
zloop_do_open_zone() only happens later in the workqueue:

drivers/block/zloop.c:zloop_set_zone_append_sector() {
	...
	rq->__sector = zone->wp;
	zone->wp += blk_rq_sectors(rq);
	if (zone->wp >= zone_end)
		zloop_mark_full(zlo, zone);

	spin_unlock(&zone->wp_lock);
	...
}

CPU0                              CPU1 (kworker)
zloop_queue_rq()
  zloop_set_zone_append_sector()
    spin_lock(&zone->wp_lock)
    zone->wp += blk_rq_sectors(rq)
    spin_unlock(&zone->wp_lock)
  queue_work(..., &cmd->work)
zloop_report_zones()
  mutex_lock(&zone->lock)
  spin_lock(&zone->wp_lock)
  blkz.wp = zone->wp;
  blkz.cond = zone->cond;  <-- still BLK_ZONE_COND_EMPTY
  spin_unlock(&zone->wp_lock)
                                  zloop_rw()
                                    zloop_seq_write_prep()
                                      mutex_lock(&zone->lock)
                                      zloop_do_open_zone()

Reporting BLK_ZONE_COND_EMPTY with an advanced write pointer causes
disk_report_zone() -> disk_zone_wplug_sync_state() ->
blk_zone_wp_offset() to treat the write pointer offset as 0 instead of
blkz.wp - blkz.start.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109095144.819709-1-dlemoal@kernel.org?part=6

  reply	other threads:[~2026-11-09 10:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  9:51 [PATCH v8 00/12] Add support for storage element depopulation Damien Le Moal
2026-11-09  9:51 ` [PATCH v8 01/12] block: introduce disk_zone_is_offline() Damien Le Moal
2026-11-09  9:51 ` [PATCH v8 02/12] block: refactor blk_revalidate_disk_zones() Damien Le Moal
2026-11-09  9:51 ` [PATCH v8 03/12] block: allow dropping all zone write plugs on revalidation Damien Le Moal
2026-11-09 11:13   ` Hannes Reinecke
2026-11-11 15:23   ` Christoph Hellwig
2026-11-09  9:51 ` [PATCH v8 04/12] block: introduce storage element management Damien Le Moal
2026-11-09 11:14   ` Hannes Reinecke
2026-11-11 15:24   ` Christoph Hellwig
2026-11-09  9:51 ` [PATCH v8 05/12] block: add storage element management ioctls Damien Le Moal
2026-11-09 11:15   ` Hannes Reinecke
2026-11-11 15:25   ` Christoph Hellwig
2026-11-09  9:51 ` [PATCH v8 06/12] zloop: fix zone reporting consistency Damien Le Moal
2026-11-09 10:06   ` sashiko-bot [this message]
2026-11-09 11:16   ` Hannes Reinecke
2026-11-11 15:27   ` Christoph Hellwig
2026-11-09  9:51 ` [PATCH v8 07/12] zloop: add storage element emulation Damien Le Moal
2026-11-09 10:15   ` sashiko-bot
2026-11-09 11:17   ` Hannes Reinecke
2026-11-09  9:51 ` [PATCH v8 08/12] zloop: add degrade_element control command Damien Le Moal
2026-11-09  9:51 ` [PATCH v8 09/12] scsi: scsi_proto: refine the definition of storage element health Damien Le Moal
2026-11-09 11:17   ` Hannes Reinecke
2026-11-11 15:28   ` Christoph Hellwig
2026-11-09  9:51 ` [PATCH v8 10/12] scsi: sd_zbc: always revalidate zones for disks supporting head depopulation Damien Le Moal
2026-11-09 11:18   ` Hannes Reinecke
2026-11-11 15:29   ` Christoph Hellwig
2026-11-09  9:51 ` [PATCH v8 11/12] scsi: sd_zbc: define storage element management operations Damien Le Moal
2026-11-09 10:13   ` sashiko-bot
2026-11-09 11:21   ` Hannes Reinecke
2026-11-09  9:51 ` [PATCH v8 12/12] scsi: sd: fail read commands to offline zones early Damien Le Moal

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=sashiko-outbox-204780@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.