From: Igor Pylypiv <ipylypiv@google.com>
To: Damien Le Moal <dlemoal@kernel.org>, Niklas Cassel <cassel@kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Hannes Reinecke <hare@suse.de>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
Igor Pylypiv <ipylypiv@google.com>
Subject: [PATCH] ata: libata-eh: Clear scsicmd->result when setting SAM_STAT_CHECK_CONDITION
Date: Wed, 4 Sep 2024 22:37:27 +0000 [thread overview]
Message-ID: <20240904223727.1149294-1-ipylypiv@google.com> (raw)
commit 24aeebbf8ea9 ("scsi: ata: libata: Change ata_eh_request_sense() to
not set CHECK_CONDITION") changed the way how SAM_STAT_CHECK_CONDITION is
set. Assignment "scmd->result = SAM_STAT_CHECK_CONDITION;" was replaced by
set_status_byte() which does not clear the scsicmd->result.
By not clearing the scsicmd->result we end up in a state where both
the DID_TIME_OUT host byte and the SAM_STAT_CHECK_CONDITION status
bytes are set.
The DID_TIME_OUT host byte is getting set a part of error handling:
ata_qc_complete()
ata_qc_schedule_eh()
blk_abort_request()
WRITE_ONCE(req->deadline, jiffies);
blk_mq_timeout_work()
blk_mq_check_expired()
blk_mq_rq_timed_out()
req->q->mq_ops->timeout() / scsi_timeout()
set_host_byte(scmd, DID_TIME_OUT);
Having the host byte set to DID_TIME_OUT for a command that didn't timeout
is confusing. Let's bring the old behavior back by setting scmd->result to
SAM_STAT_CHECK_CONDITION.
Fixes: 24aeebbf8ea9 ("scsi: ata: libata: Change ata_eh_request_sense() to not set CHECK_CONDITION")
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
drivers/ata/libata-eh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 214b935c2ced..4927b40e782f 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1605,7 +1605,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc)
*/
if (!(qc->flags & ATA_QCFLAG_SENSE_VALID) &&
(stat & ATA_SENSE) && ata_eh_request_sense(qc))
- set_status_byte(qc->scsicmd, SAM_STAT_CHECK_CONDITION);
+ qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;
if (err & ATA_ICRC)
qc->err_mask |= AC_ERR_ATA_BUS;
if (err & (ATA_UNC | ATA_AMNF))
--
2.46.0.469.g59c65b2a67-goog
next reply other threads:[~2024-09-04 22:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 22:37 Igor Pylypiv [this message]
2024-09-04 23:27 ` Igor Pylypiv
2024-09-05 8:33 ` Niklas Cassel
2024-09-05 9:25 ` Niklas Cassel
2024-09-05 12:40 ` Niklas Cassel
2024-09-05 19:28 ` Niklas Cassel
2024-09-06 18:21 ` Igor Pylypiv
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=20240904223727.1149294-1-ipylypiv@google.com \
--to=ipylypiv@google.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hare@suse.de \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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
all inboxes | Powered by JetHome®