Linux SCSI subsystem development
 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 v11 08/13] zloop: add storage element emulation
Date: Mon, 16 Nov 2026 21:59:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-217769@kernel.org> (raw)
In-Reply-To: <20261116213702.225970-9-dlemoal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] zloop: unreset ret == 0 in zloop_rw() when
  zloop_zone_rw_is_ok() fails
--

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

zloop: add storage element emulation

This commit adds storage element depopulation emulation to the zloop
driver, controlled by the new stor_elements option and implemented via
struct blk_se_ops callbacks.

> diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
> index ae7a0b0281884..a7806a73d7148 100644
> --- a/drivers/block/zloop.c
> +++ b/drivers/block/zloop.c

[ ... ]

> @@ -671,6 +819,13 @@ static void zloop_rw(struct zloop_cmd *cmd)
>  			goto out;
>  	}
>  
> +	/*
> +	 * Check if we can accept read or write commands based on the
> +	 * health state of the storage element serving the target zone.
> +	 */
> +	if (!zloop_zone_rw_is_ok(zlo, zone, op_is_write(req_op(rq))))
> +		goto out;

[Severity: High]
Can zloop_rw() jump to out with ret == 0 when zloop_zone_rw_is_ok()
rejects a command?

Right above this check, if ZLOOP_ZONE_SEQ_ERROR is set (for example,
after an earlier failed write to a sequential zone), zloop_rw() calls
ret = zloop_update_seq_zone(zlo, zone_no), which overwrites ret = -EIO
with 0 on success:

drivers/block/zloop.c:zloop_rw() {
    ...
	if (test_and_clear_bit(ZLOOP_ZONE_SEQ_ERROR, &zone->flags)) {
		mutex_lock(&zone->lock);
		ret = zloop_update_seq_zone(zlo, zone_no);
		mutex_unlock(&zone->lock);
		if (ret)
			goto out;
	}
    ...
}

When zloop_zone_rw_is_ok() then returns false and jumps to out,
zloop_rw_complete() sets cmd->ret = 0 instead of -EIO.  In
zloop_complete_rq(), a rejected REQ_OP_READ with cmd->ret == 0 is treated
as a 0-byte short read, zeroing the caller's read buffer via
zloop_fill_zero_rq(rq, 0) and completing with BLK_STS_OK instead of
BLK_STS_IOERR.  A rejected write hits the partial-write check, logs a
spurious 0-byte partial write error, and re-sets ZLOOP_ZONE_SEQ_ERROR.

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

  reply	other threads:[~2026-11-16 21:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 21:36 [PATCH v11 00/13] Add support for storage element depopulation Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 01/13] block: introduce disk_zone_is_offline() Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 02/13] block: refactor blk_revalidate_disk_zones() Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 03/13] block: allow dropping all zone write plugs on revalidation Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 04/13] block: introduce storage element management Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 05/13] block: add storage element management ioctls Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 06/13] zloop: fix ordered zone append handling Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 07/13] zloop: fix zone reporting consistency Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 08/13] zloop: add storage element emulation Damien Le Moal
2026-11-16 21:59   ` sashiko-bot [this message]
2026-11-16 21:36 ` [PATCH v11 09/13] zloop: add degrade_element control command Damien Le Moal
2026-11-16 21:44   ` sashiko-bot
2026-11-16 21:36 ` [PATCH v11 10/13] scsi: scsi_proto: refine the definition of storage element health Damien Le Moal
2026-11-16 21:37 ` [PATCH v11 11/13] scsi: sd_zbc: always revalidate zones for disks supporting head depopulation Damien Le Moal
2026-11-16 21:37 ` [PATCH v11 12/13] scsi: sd_zbc: define storage element management operations Damien Le Moal
2026-11-16 21:52   ` sashiko-bot
2026-11-16 21:37 ` [PATCH v11 13/13] 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-217769@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox