diff mbox series

[10/39] scsi_error: use DID_TIME_OUT instead of DRIVER_TIMEOUT

Message ID 20210423113944.42672-11-hare@suse.de
State Superseded
Headers show
Series SCSI result cleanup, part 2 | expand

Commit Message

Hannes Reinecke April 23, 2021, 11:39 a.m. UTC
Set DID_TIME_OUT instead of DRIVER_TIMEOUT when a command
is finally marked as failed after error recovery.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/scsi_error.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bart Van Assche April 26, 2021, 3:42 a.m. UTC | #1
On 4/23/21 4:39 AM, Hannes Reinecke wrote:
> Set DID_TIME_OUT instead of DRIVER_TIMEOUT when a command

> is finally marked as failed after error recovery.


Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Christoph Hellwig April 26, 2021, 3:21 p.m. UTC | #2
On Fri, Apr 23, 2021 at 01:39:15PM +0200, Hannes Reinecke wrote:
> Set DID_TIME_OUT instead of DRIVER_TIMEOUT when a command

> is finally marked as failed after error recovery.


This seems like something that we need to propagating to userspace
through the various sg interfaces as applications could rely on the
bit.
Hannes Reinecke April 26, 2021, 3:38 p.m. UTC | #3
On 4/26/21 5:21 PM, Christoph Hellwig wrote:
> On Fri, Apr 23, 2021 at 01:39:15PM +0200, Hannes Reinecke wrote:

>> Set DID_TIME_OUT instead of DRIVER_TIMEOUT when a command

>> is finally marked as failed after error recovery.

> 

> This seems like something that we need to propagating to userspace

> through the various sg interfaces as applications could rely on the

> bit.

> 

That would be highly surprising. That particular bit is only ever set if
a timeout has triggered, but the driver did not set any other status.
Which again does _strongly_ depend on the driver; there is not consensus
what the status should be for a timed out command.
So if userspace ever saw this value it would be strongly driver
depended, and there was never any intention that any particular driver
_would_ set this flag.
In short: if it ever was set, it was by accident.
Hence userspace shouldn't check for it.

So I don't think we need to worry about that.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		        Kernel Storage Architect
hare@suse.de			               +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 0967021cc06e..689ee628eff9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2137,10 +2137,10 @@  void scsi_eh_flush_done_q(struct list_head *done_q)
 			/*
 			 * If just we got sense for the device (called
 			 * scsi_eh_get_sense), scmd->result is already
-			 * set, do not set DRIVER_TIMEOUT.
+			 * set, do not set DID_TIME_OUT.
 			 */
 			if (!scmd->result)
-				scmd->result |= (DRIVER_TIMEOUT << 24);
+				scmd->result |= (DID_TIME_OUT << 16);
 			SCSI_LOG_ERROR_RECOVERY(3,
 				scmd_printk(KERN_INFO, scmd,
 					     "%s: flush finish cmd\n",