On 2024/08/09 7:30, Niklas Cassel wrote: > Hello Damien, > > If we want to no longer respect the D_SENSE bit for successful ATA-passthrough > commands, e.g. by replacing the ata_scsi_set_sense() call with a > scsi_build_sense() call in the else clause: > https://github.com/torvalds/linux/blob/v6.11-rc2/drivers/ata/libata-scsi.c#L955 > > ...then I think that we should also replace the ata_scsi_set_sense() call with > a scsi_build_sense() call for failed ATA-passthrough commands too > (in the non-else clause): > https://github.com/torvalds/linux/blob/v6.11-rc2/drivers/ata/libata-scsi.c#L952 > > ..however, that does not sound like a very nice solution IMO. > > > Another option, if there are a lot of user space programs that incorrectly > assume that the sense data (for both successful and failed commands) is in > descriptor format, without bothering to check the sense data type, one option > might be to change the default value of D_SENSE in the control mode page to 1 > in libata's SATL, i.e. set ATA_DFLAG_D_SENSE in dev->flags by default. > > That way, we will still respect D_SENSE while generating the sense data > (in case the user issues a mode select to modify the bit), and the default > will be to generate the sense data in descriptor format, as it has been > since 11093cb1ef56 ("libata-scsi: generate correct ATA pass-through sense"). That indeed should be acceptable. And we should also patch hdparm to properly look at the sense format and not assume descriptor format by default. -- Damien Le Moal Western Digital Research