From: Hannes Reinecke <hare@kernel.org>
To: James Bottomley <james.bottomley@hansenpartnership.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@kernel.org>
Subject: [PATCH] scsi_error: send device reset if asynchronous abort failed
Date: Wed, 10 Jun 2026 12:51:19 +0200 [thread overview]
Message-ID: <20260610105119.30903-1-hare@kernel.org> (raw)
The current SCSI EH implementation requires us to enter the error
handler before a device reset can be send, requiring us to wait for
all outstanding commands on the _host_ before a device reset can be
issued. This is causing a noticeable I/O stall on SAS JBODs if an
individual device fails.
But a device reset has a very well defined scope, so there really should
not be any implications to _other_ devices on the same host when the
device reset is issued.
So it should be possible to issue a device reset directly from
scsi_eh_abort_handler() once a command abort fails without having to
wait for outstanding commands on any other devices on the same host.
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
drivers/scsi/scsi_error.c | 17 ++++++++++++++++-
drivers/scsi/scsi_priv.h | 1 +
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 147127fb4db9..23dc50332f58 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -58,6 +58,7 @@
#define HOST_RESET_SETTLE_TIME (10)
static int scsi_eh_try_stu(struct scsi_cmnd *scmd);
+static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd);
static enum scsi_disposition scsi_try_to_abort_cmd(const struct scsi_host_template *,
struct scsi_cmnd *);
@@ -170,7 +171,16 @@ scmd_eh_abort_handler(struct work_struct *work)
"cmd abort %s\n",
(rtn == FAST_IO_FAIL) ?
"not send" : "failed"));
- goto out;
+ if (scsi_host_eh_past_deadline(shost))
+ goto out;
+ rtn = scsi_try_bus_device_reset(scmd);
+ if (rtn != SUCCESS) {
+ scmd_printk(KERN_INFO, scmd,
+ "device reset %s\n",
+ (rtn == FAST_IO_FAIL) ?
+ "not send" : "failed");
+ goto out;
+ }
}
set_host_byte(scmd, DID_TIME_OUT);
if (scsi_host_eh_past_deadline(shost)) {
@@ -1013,6 +1023,11 @@ static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
if (!hostt->eh_device_reset_handler)
return FAILED;
+ /* Device reset had already been issued, escalate to next level */
+ if (scmd->eh_eflags & SCSI_EH_RESET_SCHEDULED)
+ return FAILED;
+
+ scmd->eh_eflags |= SCSI_EH_RESET_SCHEDULED;
rtn = hostt->eh_device_reset_handler(scmd);
if (rtn == SUCCESS)
__scsi_report_device_reset(scmd->device, NULL);
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 7a193cc04e5b..be0570cea445 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -39,6 +39,7 @@ static inline u8 scsi_ml_byte(int result)
* Scsi Error Handler Flags
*/
#define SCSI_EH_ABORT_SCHEDULED 0x0002 /* Abort has been scheduled */
+#define SCSI_EH_RESET_SCHEDULED 0x0004 /* Reset has been scheduled */
#define SCSI_SENSE_VALID(scmd) \
(((scmd)->sense_buffer[0] & 0x70) == 0x70)
--
2.51.0
next reply other threads:[~2026-06-10 10:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 10:51 Hannes Reinecke [this message]
2026-06-10 11:03 ` [PATCH] scsi_error: send device reset if asynchronous abort failed sashiko-bot
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=20260610105119.30903-1-hare@kernel.org \
--to=hare@kernel.org \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.