Commit e6c11dbb8da81c599ca09ef2f6311220e068acd8

Authored by Maurizio Lombardi
Committed by Christoph Hellwig
1 parent cb23f912a9

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>

Showing 1 changed file with 4 additions and 36 deletions Side-by-side Diff

drivers/scsi/scsi_lib.c
... ... @@ -685,7 +685,6 @@
685 685 int sense_deferred = 0;
686 686 enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,
687 687 ACTION_DELAYED_RETRY} action;
688   - char *description = NULL;
689 688 unsigned long wait_for = (cmd->allowed + 1) * req->timeout;
690 689  
691 690 if (result) {
... ... @@ -810,7 +809,6 @@
810 809 * and quietly refuse further access.
811 810 */
812 811 cmd->device->changed = 1;
813   - description = "Media Changed";
814 812 action = ACTION_FAIL;
815 813 } else {
816 814 /* Must have been a power glitch, or a
817 815  
... ... @@ -838,27 +836,10 @@
838 836 cmd->device->use_10_for_rw = 0;
839 837 action = ACTION_REPREP;
840 838 } else if (sshdr.asc == 0x10) /* DIX */ {
841   - description = "Host Data Integrity Failure";
842 839 action = ACTION_FAIL;
843 840 error = -EILSEQ;
844 841 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */
845 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 843 action = ACTION_FAIL;
863 844 error = -EREMOTEIO;
864 845 } else
865 846  
... ... @@ -866,10 +847,8 @@
866 847 break;
867 848 case ABORTED_COMMAND:
868 849 action = ACTION_FAIL;
869   - if (sshdr.asc == 0x10) { /* DIF */
870   - description = "Target Data Integrity Failure";
  850 + if (sshdr.asc == 0x10) /* DIF */
871 851 error = -EILSEQ;
872   - }
873 852 break;
874 853 case NOT_READY:
875 854 /* If the device is in the process of becoming
876 855  
877 856  
878 857  
879 858  
880 859  
881 860  
882 861  
883 862  
... ... @@ -888,42 +867,31 @@
888 867 action = ACTION_DELAYED_RETRY;
889 868 break;
890 869 default:
891   - description = "Device not ready";
892 870 action = ACTION_FAIL;
893 871 break;
894 872 }
895   - } else {
896   - description = "Device not ready";
  873 + } else
897 874 action = ACTION_FAIL;
898   - }
899 875 break;
900 876 case VOLUME_OVERFLOW:
901 877 /* See SSC3rXX or current. */
902 878 action = ACTION_FAIL;
903 879 break;
904 880 default:
905   - description = "Unhandled sense code";
906 881 action = ACTION_FAIL;
907 882 break;
908 883 }
909   - } else {
910   - description = "Unhandled error code";
  884 + } else
911 885 action = ACTION_FAIL;
912   - }
913 886  
914 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 889 action = ACTION_FAIL;
917   - description = "Command timed out";
918   - }
919 890  
920 891 switch (action) {
921 892 case ACTION_FAIL:
922 893 /* Give up and fail the remainder of the request */
923 894 if (!(req->cmd_flags & REQ_QUIET)) {
924   - if (description)
925   - scmd_printk(KERN_INFO, cmd, "%s\n",
926   - description);
927 895 scsi_print_result(cmd);
928 896 if (driver_byte(result) & DRIVER_SENSE)
929 897 scsi_print_sense("", cmd);