usb: uas: expose US_FL_NO_ATA_1X in sysfs as deny_ata_passthrough
Subsystems (4)
PATCH 1/1 usb: uas: expose US_FL_NO_ATA_1X in sysfs as deny_ata_passthrough
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy (via the US_FL_NO_ATA_1X flag in unusual_uas.h and uas_detect.h). However, it does not expose any meaningful information whether the command was blocked by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message (with instructions to disable UAS on the drive to get SMART readings).
So, expose the information in sysfs as deny_ata_passthrough. Other quirks may be added in the future if there is any demand.
--- drivers/usb/storage/uas.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/usb/storage/uas.c +20 -0
@@ -910,6 +910,25 @@ static int uas_sdev_configure(struct scsi_device *sdev,return 0 ; } +/* Sysfs interface */ +static ssize_t deny_ata_passthrough_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct scsi_device *sdev =to_scsi_device (dev); +struct uas_dev_info *devinfo = sdev->hostdata; + +return sprintf (buf,"%d\n" , !!(devinfo->flags &US_FL_NO_ATA_1X )); +} + +static DEVICE_ATTR_RO (deny_ata_passthrough); + +static struct attribute *uas_sdev_attrs[] = { + &dev_attr_deny_ata_passthrough.attr, +NULL , +}; + +ATTRIBUTE_GROUPS (uas_sdev); +static const struct scsi_host_template uas_host_template = { .module =THIS_MODULE , .name ="uas" ,
@@ -929,6 +948,7 @@ static const struct scsi_host_template uas_host_template = { .dma_alignment = 511, .dma_boundary = PAGE_SIZE - 1, .cmd_size = sizeof(struct uas_cmd_info), + .sdev_groups = uas_sdev_groups, }; #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
Signature · 1 line
2.47.3
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 9 lines
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy (via the
US_FL_NO_ATA_1Xflag inunusual_uas.handuas_detect.h). However, it does not expose any meaningful information whether the command was blocked by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message (with instructions to disable UAS on the drive to get SMART readings).
Quoted 5 lines
So, expose the information in sysfs as
deny_ata_passthrough. Other quirks may be added in the future if there is any demand.
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Alan Stern
maintainerQuoted 9 lines · Mateusz Jończyk
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy (via the
US_FL_NO_ATA_1Xflag inunusual_uas.handuas_detect.h). However, it does not expose any meaningful information whether the command was blocked by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message (with instructions to disable UAS on the drive to get SMART readings).
Quoted 5 lines
So, expose the information in sysfs as
deny_ata_passthrough. Other quirks may be added in the future if there is any demand.
Why was this change made to uas but not to usb-storage? Was it because some devices can handle ATA passthrough commands over the Bulk-Only transport but not over the UAS transport? Note that the US_FL_NO_ATA_1X flag applies to both transports.
Alan Stern
W dniu 15.11.2026 o 16:52, Alan Stern pisze:
Quoted 13 lines · Mateusz Jończyk
Quoted 12 lines
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy (via the
US_FL_NO_ATA_1Xflag inunusual_uas.handuas_detect.h). However, it does not expose any meaningful information whether the command was blocked by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message (with instructions to disable UAS on the drive to get SMART readings).So, expose the information in sysfs as
deny_ata_passthrough. Other quirks may be added in the future if there is any demand.
Quoted 8 lines
Quoted 2 lines
Why was this change made to uas but not to usb-storage? Was it because some devices can handle ATA passthrough commands over the Bulk-Only transport but not over the UAS transport? Note that the
US_FL_NO_ATA_1Xflag applies to both transports.Alan Stern
There are only very few devices that cannot handle ATA passthrough commands over the Bulk-Only transfer (and with them it's impossible to get ATA passthrough by disabling UAS). But that's a fair point, will fix it in v2.
Considering the US_FL_NO_ATA_1X flag:
- I suspect that many more devices would accept the ATA passthrough commands in UAS mode if these would be issued in isolation (if uas_queuecommand_lck() would stop all other transfers while doing them). After all, Windows apparently does not carry such quirks for modern devices. I do not have the hardware to test, though.
- Since 2017, it is set unequivocally for all Seagate drives, even though most likely modern drives / firmware versions do not need it. I do not see a way out, though.
Greetings,
Mateusz
Greg Kroah-Hartman
maintainerQuoted 34 lines · Mateusz Jończyk
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy (via the
US_FL_NO_ATA_1Xflag inunusual_uas.handuas_detect.h). However, it does not expose any meaningful information whether the command was blocked by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message (with instructions to disable UAS on the drive to get SMART readings).So, expose the information in sysfs as
deny_ata_passthrough. Other quirks may be added in the future if there is any demand.Signed-off-by Mateusz Jończyk <[email protected]>--- drivers/usb/storage/uas.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/usb/storage/uas.c +8
-0@@ -910,6 +910,25 @@ static int uas_sdev_configure(struct scsi_device *sdev,return 0 ; } +/* Sysfs interface */ +static ssize_t deny_ata_passthrough_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct scsi_device *sdev =to_scsi_device (dev); +struct uas_dev_info *devinfo = sdev->hostdata; + +return sprintf (buf,"%d\n" , !!(devinfo->flags &US_FL_NO_ATA_1X ));
drivers/usb/storage/uas.c static int uas_sdev_configure(struct scsi_device *sdev, · line 930
Quoted 10 lines
drivers/usb/storage/uas.c +10
-0+} + +static DEVICE_ATTR_RO (deny_ata_passthrough); + +static struct attribute *uas_sdev_attrs[] = { + &dev_attr_deny_ata_passthrough.attr, +NULL , +}; + +ATTRIBUTE_GROUPS (uas_sdev);
Sorry, but random sysfs atttributes that are not documented are not a good idea. Especially ones that don't even use sysfs_emit().
thanks,
greg k-0h