On 10/5/23 8:12 PM, Damien Le Moal wrote: >> As far as future safety goes, this patch is not great. Right now >> we assume scsi_execute_cmd and the functions it calls does not >> return -EIO. To make it safer we could change scsi_mode_sense to >> return 1 for the case there is sense or add another arg which >> gets set when there is sense. > Indeed, that would be better because scsi does not prevent a device from > returning sense data for successfull commands as well (see device statistics or > CDL as examples). So that would be a better solution than relying on -EIO for > sense data validi For the sd_read_app_tag_own case and similar ones are you wanting to log the sense for cases like the CDL where scsi_execute_cmd returns 0? The thing is that this patches uses -EIO to indicate if the sshdr is setup (not exactly that sense is valid). If it is then we check if the sense is valid and if is then sd_read_app_tag_own will log it. In other places we do something similar and check if scsi_execute_cmd returns > 0. If it does then we know the sshdr is setup and will do something with it like print it. Those cases will not work for your CDL example because scsi_execute_cmd returns 0.