Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-131827 / 25.04 / Revert "ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error #196

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

usaleem-ix
Copy link
Contributor

Cherry-pick upstream commit 88042e4

SCALE Build: http://jenkins.eng.ixsystems.net:8080/job/master/job/custom/620/artifact/
API Tests: http://jenkins.eng.ixsystems.net:8080/job/tests/job/api_tests/1378/#showFailuresLink

hdparam -C before:

root@truenas\[~]# hdparm -C /dev/sda  

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 00 ff 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
drive state is:  unknown

hdparm -C after:

root@truenas[/]# hdparm -C /dev/sda

/dev/sda:
 drive state is:  active/idle

…error"

commit fa0db8e568787c665384430eaf2221b299b85367 upstream.

This reverts commit 28ab9769117ca944cb6eb537af5599aa436287a4.

Sense data can be in either fixed format or descriptor format.

SAT-6 revision 1, "10.4.6 Control mode page", defines the D_SENSE bit:
"The SATL shall support this bit as defined in SPC-5 with the following
exception: if the D_ SENSE bit is set to zero (i.e., fixed format sense
data), then the SATL should return fixed format sense data for ATA
PASS-THROUGH commands."

The libata SATL has always kept D_SENSE set to zero by default. (It is
however possible to change the value using a MODE SELECT SG_IO command.)

Failed ATA PASS-THROUGH commands correctly respected the D_SENSE bit,
however, successful ATA PASS-THROUGH commands incorrectly returned the
sense data in descriptor format (regardless of the D_SENSE bit).

Commit 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE bit for
CK_COND=1 and no error") fixed this bug for successful ATA PASS-THROUGH
commands.

However, after commit 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE
bit for CK_COND=1 and no error"), there were bug reports that hdparm,
hddtemp, and udisks were no longer working as expected.

These applications incorrectly assume the returned sense data is in
descriptor format, without even looking at the RESPONSE CODE field in the
returned sense data (to see which format the returned sense data is in).

Considering that there will be broken versions of these applications around
roughly forever, we are stuck with being bug compatible with older kernels.

Cc: [email protected] # 4.19+
Reported-by: Stephan Eisvogel <[email protected]>
Reported-by: Christian Heusel <[email protected]>
Closes: https://lore.kernel.org/linux-ide/[email protected]/
Fixes: 28ab9769117c ("ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error")
Reviewed-by: Hannes Reinecke <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Niklas Cassel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
@bugclerk
Copy link

@amotin amotin merged commit d9512a9 into truenas/linux-6.6 Oct 18, 2024
6 checks passed
@amotin amotin deleted the NAS-131827 branch October 18, 2024 13:59
@bugclerk
Copy link

Not updating JIRA ticket https://ixsystems.atlassian.net/browse/NAS-131827 target versions as no JIRA version corresponds to this PR

@bugclerk
Copy link

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Oct 18, 2024
@usaleem-ix usaleem-ix changed the title NAS-131827 / 24.10.1 / Revert "ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error NAS-131827 / 25.04 / Revert "ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants