Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: core: Convert scsi_decide_disposition() to use SCSIML_STAT

Don't use:

- DID_TARGET_FAILURE

- DID_NEXUS_FAILURE

- DID_ALLOC_FAILURE

- DID_MEDIUM_ERROR

Instead use the SCSI midlayer internal values.

Link: https://lore.kernel.org/r/20220812010027.8251-10-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
7dfaae6a 36ebf1e2

+11 -25
+6 -6
drivers/scsi/scsi_error.c
··· 649 649 case DATA_PROTECT: 650 650 if (sshdr.asc == 0x27 && sshdr.ascq == 0x07) { 651 651 /* Thin provisioning hard threshold reached */ 652 - set_host_byte(scmd, DID_ALLOC_FAILURE); 652 + set_scsi_ml_byte(scmd, SCSIML_STAT_NOSPC); 653 653 return SUCCESS; 654 654 } 655 655 fallthrough; ··· 657 657 case VOLUME_OVERFLOW: 658 658 case MISCOMPARE: 659 659 case BLANK_CHECK: 660 - set_host_byte(scmd, DID_TARGET_FAILURE); 660 + set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); 661 661 return SUCCESS; 662 662 663 663 case MEDIUM_ERROR: 664 664 if (sshdr.asc == 0x11 || /* UNRECOVERED READ ERR */ 665 665 sshdr.asc == 0x13 || /* AMNF DATA FIELD */ 666 666 sshdr.asc == 0x14) { /* RECORD NOT FOUND */ 667 - set_host_byte(scmd, DID_MEDIUM_ERROR); 667 + set_scsi_ml_byte(scmd, SCSIML_STAT_MED_ERROR); 668 668 return SUCCESS; 669 669 } 670 670 return NEEDS_RETRY; ··· 673 673 if (scmd->device->retry_hwerror) 674 674 return ADD_TO_MLQUEUE; 675 675 else 676 - set_host_byte(scmd, DID_TARGET_FAILURE); 676 + set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); 677 677 fallthrough; 678 678 679 679 case ILLEGAL_REQUEST: ··· 683 683 sshdr.asc == 0x24 || /* Invalid field in cdb */ 684 684 sshdr.asc == 0x26 || /* Parameter value invalid */ 685 685 sshdr.asc == 0x27) { /* Write protected */ 686 - set_host_byte(scmd, DID_TARGET_FAILURE); 686 + set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); 687 687 } 688 688 return SUCCESS; 689 689 ··· 1988 1988 case SAM_STAT_RESERVATION_CONFLICT: 1989 1989 sdev_printk(KERN_INFO, scmd->device, 1990 1990 "reservation conflict\n"); 1991 - set_host_byte(scmd, DID_NEXUS_FAILURE); 1991 + set_scsi_ml_byte(scmd, SCSIML_STAT_RESV_CONFLICT); 1992 1992 return SUCCESS; /* causes immediate i/o error */ 1993 1993 } 1994 1994 return FAILED;
+5 -19
drivers/scsi/scsi_lib.c
··· 583 583 584 584 /** 585 585 * scsi_result_to_blk_status - translate a SCSI result code into blk_status_t 586 - * @cmd: SCSI command 587 586 * @result: scsi error code 588 587 * 589 - * Translate a SCSI result code into a blk_status_t value. May reset the host 590 - * byte of @cmd->result. 588 + * Translate a SCSI result code into a blk_status_t value. 591 589 */ 592 - static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) 590 + static blk_status_t scsi_result_to_blk_status(int result) 593 591 { 594 592 /* 595 593 * Check the scsi-ml byte first in case we converted a host or status ··· 614 616 case DID_TRANSPORT_FAILFAST: 615 617 case DID_TRANSPORT_MARGINAL: 616 618 return BLK_STS_TRANSPORT; 617 - case DID_TARGET_FAILURE: 618 - set_host_byte(cmd, DID_OK); 619 - return BLK_STS_TARGET; 620 - case DID_NEXUS_FAILURE: 621 - set_host_byte(cmd, DID_OK); 622 - return BLK_STS_NEXUS; 623 - case DID_ALLOC_FAILURE: 624 - set_host_byte(cmd, DID_OK); 625 - return BLK_STS_NOSPC; 626 - case DID_MEDIUM_ERROR: 627 - set_host_byte(cmd, DID_OK); 628 - return BLK_STS_MEDIUM; 629 619 default: 630 620 return BLK_STS_IOERR; 631 621 } ··· 701 715 if (sense_valid) 702 716 sense_current = !scsi_sense_is_deferred(&sshdr); 703 717 704 - blk_stat = scsi_result_to_blk_status(cmd, result); 718 + blk_stat = scsi_result_to_blk_status(result); 705 719 706 720 if (host_byte(result) == DID_RESET) { 707 721 /* Third party bus reset or reset for error recovery ··· 879 893 SCSI_SENSE_BUFFERSIZE); 880 894 } 881 895 if (sense_current) 882 - *blk_statp = scsi_result_to_blk_status(cmd, result); 896 + *blk_statp = scsi_result_to_blk_status(result); 883 897 } else if (blk_rq_bytes(req) == 0 && sense_current) { 884 898 /* 885 899 * Flush commands do not transfers any data, and thus cannot use 886 900 * good_bytes != blk_rq_bytes(req) as the signal for an error. 887 901 * This sets *blk_statp explicitly for the problem case. 888 902 */ 889 - *blk_statp = scsi_result_to_blk_status(cmd, result); 903 + *blk_statp = scsi_result_to_blk_status(result); 890 904 } 891 905 /* 892 906 * Recovered errors need reporting, but they're always treated as