public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Holmberg <Hans.Holmberg@wdc.com>
To: Damien Le Moal <dlemoal@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Cc: hch <hch@lst.de>
Subject: Re: [PATCH] zloop: fix zone append check in zloop_rw()
Date: Wed, 19 Nov 2025 09:01:17 +0000	[thread overview]
Message-ID: <7cf2644f-e56d-47ab-a4fd-27386b1db37e@wdc.com> (raw)
In-Reply-To: <20251119043423.1668972-1-dlemoal@kernel.org>

On 19/11/2025 05:38, Damien Le Moal wrote:
> While commit cf28f6f923cb ("zloop: fail zone append operations that are
> targeting full zones") added a check in zloop_rw() that a zone append is
> not issued to a full zone, commit e3a96ca90462 ("zloop: simplify checks
> for writes to sequential zones") inadvertently removed the check to
> verify that there is enough unwritten space in a zone for an incoming
> zone append opration.
> 
> Re-add this check in zloop_rw() to make sure we do not write beyond the
> end of a zone. Of note is that this same check is already present in the
> function zloop_set_zone_append_sector() when ordered zone append is in
> use.
> 
> Reported-by: Hans Holmberg <Hans.Holmberg@wdc.com>
> Fixes: e3a96ca90462 ("zloop: simplify checks for writes to sequential zones")
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/block/zloop.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
> index c4da3116f7a9..1273bbca7843 100644
> --- a/drivers/block/zloop.c
> +++ b/drivers/block/zloop.c
> @@ -448,7 +448,8 @@ static void zloop_rw(struct zloop_cmd *cmd)
>  			 * and set the target sector in zloop_queue_rq().
>  			 */
>  			if (!zlo->ordered_zone_append) {
> -				if (zone->cond == BLK_ZONE_COND_FULL) {
> +				if (zone->cond == BLK_ZONE_COND_FULL ||
> +				    zone->wp + nr_sectors > zone_end) {
>  					spin_unlock_irqrestore(&zone->wp_lock,
>  							       flags);
>  					ret = -EIO;

Looks good,

Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>

  parent reply	other threads:[~2025-11-19  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  4:34 [PATCH] zloop: fix zone append check in zloop_rw() Damien Le Moal
2025-11-19  5:40 ` Christoph Hellwig
2025-11-19  9:01 ` Hans Holmberg [this message]
2025-11-19 14:39 ` Jens Axboe

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=7cf2644f-e56d-47ab-a4fd-27386b1db37e@wdc.com \
    --to=hans.holmberg@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.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