On 10/12/24 2:55 AM, 张翔 wrote: > > > For commands coming from sd, then scsi_io_completion will end up calling > scsi_io_completion_action and seeing the UNIT_ATTENTION and will retry. > I'm not saying we shouldn't do a fix like you did below. Just want to > make sure I understand the case you describe above. > > > For commands coming from sd, then scsi_complete calling scsi_decide_disposition to get "enum scsi_disposition", scsi_decide_disposition seeing the SAM_STAT_CHECK_CONDITION and calling scsi_check_sense function, then scsi_check_sense seeing UNIT_ATTENTION. If expecting_cc_ua == 1, scsi_check_sense return NEEDS_RETRY and scsi_complete will retry. For sd, scsi_decide_disposition will return SUCCESS. scsi_complete will call scsi_finish_command. In there we call the upper layer done callback, sd_done, and it will return 0 as there are no good bytes. scsi_io_completion will initially complete 0 bytes. If there are retries left then we call scsi_io_completion_action which sees the UA and will retry.