aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2014-07-10 03:41:53 -0400
committerChristoph Hellwig <hch@lst.de>2014-07-17 16:07:46 -0400
commite6c11dbb8da81c599ca09ef2f6311220e068acd8 (patch)
treeacaef0ac78a6e1f9ed94560aa221ab95be48043c /drivers/scsi/scsi_lib.c
parentcb23f912a906d023940b54b403a1b7d6bfb97416 (diff)
scsi_lib: remove the description string in scsi_io_completion()
During IO with fabric faults, one generally sees several "Unhandled error code" messages in the syslog as shown below: sd 4:0:6:2: [sdbw] Unhandled error code sd 4:0:6:2: [sdbw] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK sd 4:0:6:2: [sdbw] CDB: Read(10): 28 00 00 00 00 00 00 00 08 00 end_request: I/O error, dev sdbw, sector 0 This comes from scsi_io_completion (in scsi_lib.c) while handling error codes other than DID_RESET or not deferred sense keys i.e. this is actually handled by the SCSI mid layer. But what gets displayed here is "Unhandled error code" which is quite misleading as it indicates something that is not addressed by the mid layer. The description string is based on the sense key and sometimes on the additional sense code; since the ACTION_FAIL case always prints the sense key and the additional sense code, this patch removes the description string completely because it does not add useful information. Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index db7b7f2c14b8..03076b2b5deb 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -685,7 +685,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
685 int sense_deferred = 0; 685 int sense_deferred = 0;
686 enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY, 686 enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,
687 ACTION_DELAYED_RETRY} action; 687 ACTION_DELAYED_RETRY} action;
688 char *description = NULL;
689 unsigned long wait_for = (cmd->allowed + 1) * req->timeout; 688 unsigned long wait_for = (cmd->allowed + 1) * req->timeout;
690 689
691 if (result) { 690 if (result) {
@@ -810,7 +809,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
810 * and quietly refuse further access. 809 * and quietly refuse further access.
811 */ 810 */
812 cmd->device->changed = 1; 811 cmd->device->changed = 1;
813 description = "Media Changed";
814 action = ACTION_FAIL; 812 action = ACTION_FAIL;
815 } else { 813 } else {
816 /* Must have been a power glitch, or a 814 /* Must have been a power glitch, or a
@@ -838,27 +836,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
838 cmd->device->use_10_for_rw = 0; 836 cmd->device->use_10_for_rw = 0;
839 action = ACTION_REPREP; 837 action = ACTION_REPREP;
840 } else if (sshdr.asc == 0x10) /* DIX */ { 838 } else if (sshdr.asc == 0x10) /* DIX */ {
841 description = "Host Data Integrity Failure";
842 action = ACTION_FAIL; 839 action = ACTION_FAIL;
843 error = -EILSEQ; 840 error = -EILSEQ;
844 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */ 841 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */
845 } else if (sshdr.asc == 0x20 || sshdr.asc == 0x24) { 842 } else if (sshdr.asc == 0x20 || sshdr.asc == 0x24) {
846 switch (cmd->cmnd[0]) {
847 case UNMAP:
848 description = "Discard failure";
849 break;
850 case WRITE_SAME:
851 case WRITE_SAME_16:
852 if (cmd->cmnd[1] & 0x8)
853 description = "Discard failure";
854 else
855 description =
856 "Write same failure";
857 break;
858 default:
859 description = "Invalid command failure";
860 break;
861 }
862 action = ACTION_FAIL; 843 action = ACTION_FAIL;
863 error = -EREMOTEIO; 844 error = -EREMOTEIO;
864 } else 845 } else
@@ -866,10 +847,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
866 break; 847 break;
867 case ABORTED_COMMAND: 848 case ABORTED_COMMAND:
868 action = ACTION_FAIL; 849 action = ACTION_FAIL;
869 if (sshdr.asc == 0x10) { /* DIF */ 850 if (sshdr.asc == 0x10) /* DIF */
870 description = "Target Data Integrity Failure";
871 error = -EILSEQ; 851 error = -EILSEQ;
872 }
873 break; 852 break;
874 case NOT_READY: 853 case NOT_READY:
875 /* If the device is in the process of becoming 854 /* If the device is in the process of becoming
@@ -888,42 +867,31 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
888 action = ACTION_DELAYED_RETRY; 867 action = ACTION_DELAYED_RETRY;
889 break; 868 break;
890 default: 869 default:
891 description = "Device not ready";
892 action = ACTION_FAIL; 870 action = ACTION_FAIL;
893 break; 871 break;
894 } 872 }
895 } else { 873 } else
896 description = "Device not ready";
897 action = ACTION_FAIL; 874 action = ACTION_FAIL;
898 }
899 break; 875 break;
900 case VOLUME_OVERFLOW: 876 case VOLUME_OVERFLOW:
901 /* See SSC3rXX or current. */ 877 /* See SSC3rXX or current. */
902 action = ACTION_FAIL; 878 action = ACTION_FAIL;
903 break; 879 break;
904 default: 880 default:
905 description = "Unhandled sense code";
906 action = ACTION_FAIL; 881 action = ACTION_FAIL;
907 break; 882 break;
908 } 883 }
909 } else { 884 } else
910 description = "Unhandled error code";
911 action = ACTION_FAIL; 885 action = ACTION_FAIL;
912 }
913 886
914 if (action != ACTION_FAIL && 887 if (action != ACTION_FAIL &&
915 time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { 888 time_before(cmd->jiffies_at_alloc + wait_for, jiffies))
916 action = ACTION_FAIL; 889 action = ACTION_FAIL;
917 description = "Command timed out";
918 }
919 890
920 switch (action) { 891 switch (action) {
921 case ACTION_FAIL: 892 case ACTION_FAIL:
922 /* Give up and fail the remainder of the request */ 893 /* Give up and fail the remainder of the request */
923 if (!(req->cmd_flags & REQ_QUIET)) { 894 if (!(req->cmd_flags & REQ_QUIET)) {
924 if (description)
925 scmd_printk(KERN_INFO, cmd, "%s\n",
926 description);
927 scsi_print_result(cmd); 895 scsi_print_result(cmd);
928 if (driver_byte(result) & DRIVER_SENSE) 896 if (driver_byte(result) & DRIVER_SENSE)
929 scsi_print_sense("", cmd); 897 scsi_print_sense("", cmd);