Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Niklas Cassel" <cassel@kernel.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 4/6] scsi: scsi_debug: Enforce physical block alignment of zoned writes
Date: Thu, 17 Sep 2026 13:09:48 +0000	[thread overview]
Message-ID: <20260917130949.1136F1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917125445.1376493-12-cassel@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] scsi: scsi_debug: ZBC write physical block boundary check ignores lowest_aligned
--

commit 6fe3c0eff911c1b4e6a4a33707f2eb37306c8d19
Author: Niklas Cassel <cassel@kernel.org>

scsi: scsi_debug: Enforce physical block alignment of zoned writes

This commit enforces the requirement from ZBC-3 that write commands to
sequential write required zones must end on a physical block boundary.
It does this by adding a check in check_zbc_access_params() to ensure
the transfer length aligns with the physical block size.

> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 41c8d958f4458..64f32d97455d6 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -3980,6 +3980,16 @@ static int check_zbc_access_params(struct scsi_cmnd *scp,
[ ... ]
> +		/*
> +		 * Writes must end on a physical block boundary, that is, the
> +		 * transfer length must be a multiple of the physical block
> +		 * size.
> +		 */
> +		if (!IS_ALIGNED(lba + num, 1U << sdebug_physblk_exp)) {

[Severity: Medium]
Does this alignment check ignore the physical block offset?

If a ZBC device is configured with lowest_aligned > 0 (for example
zbc=managed, physblk_exp > 0, lowest_aligned > 0), valid write commands
to sequential required zones where the ending LBA perfectly aligns with
the advertised physical block boundary (meaning lba + num - lowest_aligned
is a multiple of the physical block size) will be rejected with an ILLEGAL
REQUEST (UNALIGNED WRITE COMMAND) sense key. This breaks device emulation
and fails valid I/O. Invalid writes might also be accepted, violating the
ZBC-3 standard.

Should this check subtract sdebug_lowest_aligned to compute the correct
physical block boundary as required by SBC-5?

> +			mk_sense_buffer(scp, ILLEGAL_REQUEST,
> +					UNALIGNED_WRITE_COMMAND);
> +			return check_condition_result;
> +		}
>  	}
>  
>  	/* Handle implicit open of closed and empty zones */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917125445.1376493-8-cassel@kernel.org?part=4

  reply	other threads:[~2026-09-17 13:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 12:54 [PATCH v3 0/6] scsi: scsi_debug: fix zoned write validation Niklas Cassel
2026-09-17 12:54 ` [PATCH v3 1/6] scsi: scsi_debug: Report the residual of a write Niklas Cassel
2026-09-17 13:04   ` sashiko-bot
2026-09-17 13:06   ` Damien Le Moal
2026-09-17 12:54 ` [PATCH v3 2/6] scsi: scsi_debug: Do not write a partial physical block Niklas Cassel
2026-09-17 13:11   ` Damien Le Moal
2026-09-17 13:47     ` Niklas Cassel
2026-09-17 12:54 ` [PATCH v3 3/6] scsi: scsi_debug: Advance the write pointer over the data written Niklas Cassel
2026-09-17 13:13   ` Damien Le Moal
2026-09-17 12:54 ` [PATCH v3 4/6] scsi: scsi_debug: Enforce physical block alignment of zoned writes Niklas Cassel
2026-09-17 13:09   ` sashiko-bot [this message]
2026-09-17 12:54 ` [PATCH v3 5/6] scsi: scsi_debug: Map the region written by WRITE ATOMIC (16) Niklas Cassel
2026-09-17 13:12   ` sashiko-bot
2026-09-17 14:01     ` Niklas Cassel
2026-09-17 13:14   ` Damien Le Moal
2026-09-17 12:54 ` [PATCH v3 6/6] scsi: scsi_debug: Validate zone access for " Niklas Cassel
2026-09-17 13:15   ` Damien Le Moal
2026-09-17 13:05 ` [PATCH v3 0/6] scsi: scsi_debug: fix zoned write validation 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=20260917130949.1136F1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cassel@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