Bug 199155

Summary: /sys/block/dev/device/model truncates to 16 characters
Product: IO/Storage Reporter: Bryan Seitz (seitzbg)
Component: SCSIAssignee: linux-scsi (linux-scsi)
Status: RESOLVED INVALID    
Severity: normal CC: mkp
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.4 to 4.16 Subsystem:
Regression: No Bisected commit-id:

Description Bryan Seitz 2018-03-21 01:13:16 UTC
When trying to determine the model of a disk to compare against an ordered BOM I saw that this field was limited to 16 characters in:

https://elixir.bootlin.com/linux/v4.16-rc6/source/drivers/scsi/scsi_sysfs.c#L638

hdparm -I which uses an IOCTL obtains the full model name such as:

INTEL SSDSC2KB240G7

Where the sysfs entry says:
INTEL SSDSC2KB24


I don't know if this is a bug or if longer than 16 chars is out of spec.  Ideally sysfs would show the full model name if possible.
Comment 1 Martin K. Petersen 2018-03-22 01:30:16 UTC
SCSI model strings are only 16 bytes in length and thus can't contain a full ATA model number identifier.
Comment 2 Bryan Seitz 2018-03-22 04:08:13 UTC
Is there some other place this is stored under /sys ?
Comment 3 d gilbert 2018-03-22 09:50:40 UTC
On 2018-03-22 05:08 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=199155
> 
> --- Comment #2 from Bryan Seitz (seitzbg@gmail.com) ---
> Is there some other place this is stored under /sys ?
> 

There shouldn't be any need. If that SATA SSD is behind a compliant
SATL (SCSI to ATA Translation Layer) then it should supply the ATA
Information VPD page plus a SCSI ATA PASS-THROUGH command so that
an ATA Identify command can be tunnelled through to the SSD (and
the response will have the untruncated device details). Tools like
smartmontools use that ATA PASS-THROUGH.

This is a SATA SSD connected via a USB Type C to SATA dongle that
uses UASP.

# lsscsi -gs
[0:0:0:0]  disk INTEL SS DSA2M080G2GC 2CV1 /dev/sda  /dev/sg0  80.0GB


# hdparm -I /dev/sg0

/dev/sg0:

ATA device, with non-removable media
	Model Number:       INTEL SSDSA2M080G2GC
	Serial Number:      CVPO017405HT080JGN
	Firmware Revision:  2CV102M3
	Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 
2.5, SATA Rev 2.6
....


Note that is not the transport connected to my laptop (USB is).

# sg_vpd -p ai /dev/sda
fetching VPD page failed: Illegal request
sg_vpd failed: Illegal request

That is not good, the SATL should implement the AI VPD page.


# smartctl -a /dev/sg0
smartctl 6.7 2018-03-07 r4718 [x86_64-linux-4.16.0-rc1+] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               INTEL SS
Product:              DSA2M080G2GC
Revision:             2CV1
Compliance:           SPC-4
....

So smartctl thinks its a SCSI device, but if told there is a SATL:

# smartctl -a -d sat /dev/sg0
smartctl 6.7 2018-03-07 r4718 [x86_64-linux-4.16.0-rc1+] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Intel X18-M/X25-M/X25-V G2 SSDs
Device Model:     INTEL SSDSA2M080G2GC
Serial Number:    CVPO017405HT080JGN
....


So now smartctl sees that it is a SATA SSD. BTW there is some discussion
on the smartmontool dev list about changing that default. That means
that all SCSI storage devices would be checked for the presence of a SATL
and if it was present automatically switch to "ATA" mode.

Doug Gilbert
Comment 4 Bryan Seitz 2018-03-22 21:05:08 UTC
Thanks Doug!