From: Damien Le Moal <dlemoal@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: cassel@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v3 1/5] ata: libata: rename ata_dev_is_zac()
Date: Fri, 3 Jul 2026 15:15:48 +0900 [thread overview]
Message-ID: <088a4644-0c5a-46b4-9491-61b941c22f41@kernel.org> (raw)
In-Reply-To: <20260703045945.BA9F11F000E9@smtp.kernel.org>
On 7/3/26 13:59, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The patch introduces an undocumented functional change (implicit bug fix) for Device Managed zoned drives, while the commit message falsely claims the refactor merely replaces identical open-coded tests.
> --
>
> commit c24879d1eda5cc422a0b0da776fb6aef5fe25e22
> Author: Damien Le Moal <dlemoal@kernel.org>
>
> ata: libata: rename ata_dev_is_zac()
>
> The helper function ata_dev_is_zac() checks if a device is a ZAC class
> device (host managed zoned disk) or if it is a host aware zoned disk, that
> is, a regular ATA disk that supports the zoned capabilities. So the name
> of this helper function is confusing as it hints at the first case only.
>
> Rename this helper function to ata_dev_is_zoned() to avoid confusions and
> better reflect the two cases tested. Use this helper in
> ata_scsiop_inq_std(), ata_scsiop_read_cap() and
> ata_scsi_report_supported_opcodes() instead of having the same tests open
> coded.
>
> While at it, to stay consistent with this renaming, also rename
> ata_dev_config_zac() to ata_dev_config_zoned().
>
>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>> index d54ec1631e9a6..a86721b5df7f6 100644
>> --- a/drivers/ata/libata-scsi.c
>> +++ b/drivers/ata/libata-scsi.c
>> @@ -2020,7 +2020,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_device *dev,
>> if (rbuf[32] == 0 || rbuf[32] == ' ')
>> memcpy(&rbuf[32], "n/a ", 4);
>>
>> - if (ata_id_zoned_cap(dev->id) || dev->class == ATA_DEV_ZAC)
>> + if (ata_dev_is_zoned(dev))
>
> [Severity: Medium]
> Does this introduce an undocumented functional change for Device Managed
> zoned drives?
>
> The commit message states this is a replacement of "the same tests open coded",
> but the old condition would evaluate to true for Device Managed drives,
> since ata_id_zoned_cap() returns 0x02 for them.
>
> The new ata_dev_is_zoned() helper checks ata_id_zoned_cap(dev->id) == 0x01,
> which evaluates to false for Device Managed drives.
>
> This appears to alter SCSI emulation for these drives, as they will no longer
> report ZBC version compatibility here.
>
> Could the commit message be updated to mention this functional bug fix?
>
>> memcpy(rbuf + 58, versions_zbc, sizeof(versions_zbc));
>> else
>> memcpy(rbuf + 58, versions, sizeof(versions));
Correct. But I think that we should never had reported that. In any case, with
host aware also now deprecated, we now definitely do *not* want to report that a
drive managed disk is compatible zbc, as we treat such drives no different than
regular disks.
>
> [ ... ]
>
>> @@ -2848,7 +2848,7 @@ static unsigned int ata_scsiop_read_cap(struct ata_device *dev,
>> rbuf[10] = sector_size >> (8 * 1);
>> rbuf[11] = sector_size;
>>
>> - if (ata_id_zoned_cap(dev->id) || dev->class == ATA_DEV_ZAC)
>> + if (ata_dev_is_zoned(dev))
>> rbuf[12] = (1 << 4); /* RC_BASIS */
>
> [Severity: Medium]
> Similarly, does this silently fix Device Managed drives incorrectly
> reporting the RC_BASIS bit in READ CAPACITY 16?
The old code was buggy ! we do not want to set rc basis for drive managed devices.
>
>> rbuf[13] = log2_per_phys;
>> rbuf[14] = (lowest_aligned >> 8) & 0x3f;
>
> [ ... ]
>
>> @@ -3656,8 +3656,7 @@ static unsigned int ata_scsi_report_supported_opcodes(struct ata_device *dev,
>> break;
>> case ZBC_IN:
>> case ZBC_OUT:
>> - if (ata_id_zoned_cap(dev->id) ||
>> - dev->class == ATA_DEV_ZAC)
>> + if (ata_dev_is_zoned(dev))
>> supported = 3;
>
> [Severity: Medium]
> Does this also correctly prevent ZBC_IN and ZBC_OUT from being reported as
> supported for Device Managed drives?
Yes it does and that is fine.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-07-03 6:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 4:05 [PATCH v3 0/5] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03 4:05 ` [PATCH v3 1/5] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-03 4:59 ` sashiko-bot
2026-07-03 6:15 ` Damien Le Moal [this message]
2026-07-03 4:05 ` [PATCH v3 2/5] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03 6:44 ` Hannes Reinecke
2026-07-03 7:05 ` Damien Le Moal
2026-07-03 7:06 ` Hannes Reinecke
2026-07-03 4:05 ` [PATCH v3 3/5] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03 4:05 ` [PATCH v3 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-03 4:27 ` sashiko-bot
2026-07-03 4:05 ` [PATCH v3 5/5] ata: libata-scsi: support the all command format for reporting supported commands 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=088a4644-0c5a-46b4-9491-61b941c22f41@kernel.org \
--to=dlemoal@kernel.org \
--cc=cassel@kernel.org \
--cc=linux-ide@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