From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v11 09/13] zloop: add degrade_element control command
Date: Mon, 16 Nov 2026 21:44:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-217750@kernel.org> (raw)
In-Reply-To: <20261116213702.225970-10-dlemoal@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] zloop: zloop_rw() fails to set -EIO when zloop_zone_rw_is_ok()
fails
--
commit c96e6d1fd4da5400dd5befd118994f57ffa77920
Author: Damien Le Moal <dlemoal@kernel.org>
zloop: add degrade_element control command
This commit adds the "degrade_element" control command to mark a zloop
storage element as degraded so that reads or writes to zones served by it
fail.
> diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
> index a7806a73d7148..dcfcd100b7baa 100644
> --- a/drivers/block/zloop.c
> +++ b/drivers/block/zloop.c
[ ... ]
> @@ -1173,6 +1177,31 @@ static int zloop_report_elements(struct gendisk *disk,
> return 0;
> }
>
> +static int zloop_degrade_element(struct zloop_device *zlo,
> + unsigned int element_id)
> +{
> + struct blk_se *se;
> + int ret = 0;
> +
> + if (zlo->stor_elements == ZLOOP_STOR_ELEMENTS_NONE)
> + return -EOPNOTSUPP;
> +
> + if (!element_id || element_id > zlo->nr_elements)
> + return -EINVAL;
> +
> + mutex_lock(&zlo->stor_elements_lock);
> +
> + se = &zlo->elements[element_id - 1];
> + if (READ_ONCE(se->status) <= BLK_SE_STS_DEGRADED)
> + WRITE_ONCE(se->status, BLK_SE_STS_DEGRADED);
> + else
> + ret = -EINVAL;
> +
> + mutex_unlock(&zlo->stor_elements_lock);
> +
> + return ret;
> +}
[Severity: High]
Can a read to a sequential zone on a degraded element complete with
cmd->ret == 0 instead of -EIO after a failed write?
When a write to a sequential zone fails (including when rejected by a
degraded element), zloop_complete_rq() sets ZLOOP_ZONE_SEQ_ERROR. On the
next I/O to that zone, zloop_rw() clears ZLOOP_ZONE_SEQ_ERROR and calls
zloop_update_seq_zone(), which succeeds and overwrites ret with 0 before
zloop_zone_rw_is_ok() checks the element status:
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;
}
/*
* 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;
...
out:
if (ret != -EIOCBQUEUED)
zloop_rw_complete(&cmd->iocb, ret);
...
}
When zloop_zone_rw_is_ok() returns false and jumps to out, ret is still 0.
For a read request, zloop_complete_rq() treats cmd->ret == 0 as a short
read, zeroes the request buffer via zloop_fill_zero_rq(), and completes the
request with BLK_STS_OK instead of failing it.
Setting ret = -EIO before jumping to out when zloop_zone_rw_is_ok() fails
(or running zloop_zone_rw_is_ok() before the ZLOOP_ZONE_SEQ_ERROR check)
would avoid this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116213702.225970-1-dlemoal@kernel.org?part=9
next prev parent reply other threads:[~2026-11-16 21:44 UTC|newest]
Thread overview: 15+ 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:36 ` [PATCH v11 09/13] zloop: add degrade_element control command Damien Le Moal
2026-11-16 21:44 ` sashiko-bot [this message]
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: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-217750@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