scsi_lib: fix scsi_io_completion's SG_IO error propagation
PATCH 1/1 scsi_lib: fix scsi_io_completion's SG_IO error propagation
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's SG_IO error handling:
47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR
Given that certain ILLEGAL_REQUEST are now properly categorized as TARGET_ERROR the host_byte is being set (before host_byte wasn't ever set for these ILLEGAL_REQUEST).
In scsi_io_completion, initialize req->errors with cmd->result _after_ the SG_IO block that calls __scsi_error_from_host_byte (which may modify the host_byte).
Before this fix:
cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer empty
After:
cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):
70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00
00 00 00--- drivers/scsi/scsi_lib.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/scsi_lib.c +4 -1
@@ -753,7 +753,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) }if (req->cmd_type ==REQ_TYPE_BLOCK_PC ) {/* SG_IO ioctl from block level */ - req->errors = result;if (result) {if (sense_valid && req->sense) {/*
@@ -769,6 +768,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)if (!sense_deferred) error =__scsi_error_from_host_byte (cmd, result); } +/* +* __scsi_error_from_host_byte may have reset the host_byte +*/ + req->errors = cmd->result; req->resid_len =scsi_get_resid (cmd);
Signature · 1 line
1.7.1
Il 31/05/2012 21:05, Mike Snitzer ha scritto:
Quoted 39 lines
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's
SG_IOerror handling:
47ac56d [SCSI]scsi_error: classify someILLEGAL_REQUESTsense as a permanentTARGET_ERRORGiven that certain
ILLEGAL_REQUESTare now properly categorized asTARGET_ERRORthehost_byteis being set (beforehost_bytewasn't ever set for theseILLEGAL_REQUEST).In
scsi_io_completion, initializereq->errorswithcmd->result_after_ theSG_IOblock that calls__scsi_error_from_host_byte(which may modify thehost_byte).Before this fix:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer emptyAfter:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):
Quoted 5 lines
70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00 00 00 00Signed-off-by Mike Snitzer <[email protected]>Reviewed-by Babu Moger <[email protected]>
Paolo
Quoted 28 lines
Cc [email protected] # 3.4--- drivers/scsi/scsi_lib.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/scsi/scsi_lib.c +4
-1@@ -753,7 +753,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) }if (req->cmd_type ==REQ_TYPE_BLOCK_PC ) {/* SG_IO ioctl from block level */ - req->errors = result;if (result) {if (sense_valid && req->sense) {/* @@ -769,6 +768,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)if (!sense_deferred) error =__scsi_error_from_host_byte (cmd, result); } +/* +* __scsi_error_from_host_byte may have reset the host_byte +*/ + req->errors = cmd->result; req->resid_len =scsi_get_resid (cmd);
Quoted 43 lines · Paolo Bonzini
Il 31/05/2012 21:05, Mike Snitzer ha scritto:
Quoted 42 lines
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's
SG_IOerror handling:
47ac56d [SCSI]scsi_error: classify someILLEGAL_REQUESTsense as a permanentTARGET_ERRORGiven that certain
ILLEGAL_REQUESTare now properly categorized asTARGET_ERRORthehost_byteis being set (beforehost_bytewasn't ever set for theseILLEGAL_REQUEST).In
scsi_io_completion, initializereq->errorswithcmd->result_after_ theSG_IOblock that calls__scsi_error_from_host_byte(which may modify thehost_byte).Before this fix:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer emptyAfter:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00 00 00 00
Quoted 5 lines
Quoted 2 lines
Signed-off-by Mike Snitzer <[email protected]>Reviewed-by Babu Moger <[email protected]>Reported-by Paolo Bonzini <[email protected]>Tested-by Paolo Bonzini <[email protected]>
Yes, thanks for backfilling the Reported-by and Tested-by Paolo!
Thanks Mike. Looks good.
Quoted 63 lines
-----Original Message-----
From: Mike Snitzer [mailto:[email protected]]
Sent: Thursday, May 31, 2012 3:24 PM
To: Paolo Bonzini
Cc: [email protected]; Moger, Babu; [email protected]; [email protected]; [email protected]; [email protected].#.3.4
Subject: Re:scsi_lib: fix scsi_io_completion'sSG_IOerror propagationQuoted 4 lines · Paolo Bonzini
Il 31/05/2012 21:05, Mike Snitzer ha scritto:
Quoted 3 lines
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's
SG_IOerror handling:
47ac56d [SCSI]scsi_error: classify someILLEGAL_REQUESTsense as apermanent
TARGET_ERRORQuoted 39 lines
Quoted 39 lines
Given that certain
ILLEGAL_REQUESTare now properly categorized asTARGET_ERRORthehost_byteis being set (beforehost_bytewasn't ever set for theseILLEGAL_REQUEST).In
scsi_io_completion, initializereq->errorswithcmd->result_after_ theSG_IOblock that calls__scsi_error_from_host_byte(which may modify thehost_byte).Before this fix:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer emptyAfter:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00 00 00 00Quoted 5 lines
Quoted 2 lines
Signed-off-by Mike Snitzer <[email protected]>Reviewed-by Babu Moger <[email protected]>Reported-by Paolo Bonzini <[email protected]>Tested-by Paolo Bonzini <[email protected]>Yes, thanks for backfilling the Reported-by and Tested-by Paolo!
Hi James,
Seems this one slipped through the cracks. Please review/apply.
Thanks,
Mike
Quoted 65 lines · Babu
Thanks Mike. Looks good.
Quoted 63 lines
-----Original Message-----
From: Mike Snitzer [mailto:[email protected]]
Sent: Thursday, May 31, 2012 3:24 PM
To: Paolo Bonzini
Cc: [email protected]; Moger, Babu; [email protected]; [email protected]; [email protected]; [email protected].#.3.4
Subject: Re:scsi_lib: fix scsi_io_completion'sSG_IOerror propagationQuoted 4 lines · Paolo Bonzini
Il 31/05/2012 21:05, Mike Snitzer ha scritto:
Quoted 3 lines
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's
SG_IOerror handling:
47ac56d [SCSI]scsi_error: classify someILLEGAL_REQUESTsense as apermanent
TARGET_ERRORQuoted 39 lines
Quoted 39 lines
Given that certain
ILLEGAL_REQUESTare now properly categorized asTARGET_ERRORthehost_byteis being set (beforehost_bytewasn't ever set for theseILLEGAL_REQUEST).In
scsi_io_completion, initializereq->errorswithcmd->result_after_ theSG_IOblock that calls__scsi_error_from_host_byte(which may modify thehost_byte).Before this fix:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer emptyAfter:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00 00 00 00Quoted 5 lines
Quoted 2 lines
Signed-off-by Mike Snitzer <[email protected]>Reviewed-by Babu Moger <[email protected]>Reported-by Paolo Bonzini <[email protected]>Tested-by Paolo Bonzini <[email protected]>Yes, thanks for backfilling the Reported-by and Tested-by Paolo!
PATCH RESEND 1/1 SCSI: scsi_lib: fix scsi_io_completion's SG_IO error propagation
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's SG_IO error handling:
47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR
Given that certain ILLEGAL_REQUEST are now properly categorized as TARGET_ERROR the host_byte is being set (before host_byte wasn't ever set for these ILLEGAL_REQUEST).
In scsi_io_completion, initialize req->errors with cmd->result _after_ the SG_IO block that calls __scsi_error_from_host_byte (which may modify the host_byte).
Before this fix:
cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer empty
After:
cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):
70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00
00 00 00--- drivers/scsi/scsi_lib.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/scsi_lib.c +4 -1
@@ -759,7 +759,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) }if (req->cmd_type ==REQ_TYPE_BLOCK_PC ) {/* SG_IO ioctl from block level */ - req->errors = result;if (result) {if (sense_valid && req->sense) {/*
@@ -775,6 +774,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)if (!sense_deferred) error =__scsi_error_from_host_byte (cmd, result); } +/* +* __scsi_error_from_host_byte may have reset the host_byte +*/ + req->errors = cmd->result; req->resid_len =scsi_get_resid (cmd);
Signature · 1 line
1.7.4.4
Re: [RESEND PATCH] SCSI: scsi_lib: fix scsi_io_completion's SG_IO error propagation
Quoted 39 lines · Mike Snitzer
The following v3.4-rc1 commit unmasked an existing bug in scsi_io_completion's
SG_IOerror handling:
47ac56d [SCSI]scsi_error: classify someILLEGAL_REQUESTsense as a permanentTARGET_ERRORGiven that certain
ILLEGAL_REQUESTare now properly categorized asTARGET_ERRORthehost_byteis being set (beforehost_bytewasn't ever set for theseILLEGAL_REQUEST).In
scsi_io_completion, initializereq->errorswithcmd->result_after_ theSG_IOblock that calls__scsi_error_from_host_byte(which may modify thehost_byte).Before this fix:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
sense buffer emptyAfter:
cdb to send: 12 01 01 00 00 00 ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0, status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b, 00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=0, duration=0, info=0x1}) = 0SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):
Quoted 8 lines
70 00 05 00 00 00 00 0b 00 00 00 00 24 00 00 00 00 00 00Signed-off-by Mike Snitzer <[email protected]>Reported-by Paolo Bonzini <[email protected]>Tested-by Paolo Bonzini <[email protected]>Reviewed-by Babu Moger <[email protected]>Cc [email protected] [v3.4+]
Cheers,
Hannes--
Dr. Hannes Reinecke zSeries & Storage
[email protected] +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html