Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 157927 - model numbers for drives are truncated by two hex digits when libata PATA drivers are used
Summary: model numbers for drives are truncated by two hex digits when libata PATA dri...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-12 08:54 UTC by Mike Mattie
Modified: 2007-04-27 12:54 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
diagnostic patch (diff,645 bytes, patch)
2007-04-25 15:22 UTC, Daniel Drake (RETIRED)
Details | Diff
pata output from 2.7.21-rc7 (pata-diagnostic,16.00 KB, text/plain)
2007-04-26 05:28 UTC, Mike Mattie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Mattie 2006-12-12 08:54:57 UTC
running udev-103

the scsi_id truncates ATA drive model numbers by two hex digits when using
ATA drives with the libata PATA drivers.

ENV{ID_MODEL}=="WDC_WD400BB-00DEA0", SYMLINK+="sysdisk/dev-image"
^^^^^^^
matches with old ide drivers.

ENV{ID_MODEL}=="WDC_WD400BB-00DE", SYMLINK+="sysdisk/dev-image"
^^^^^^^^^
this is required to match with the new libata PATA drivers.

this is snipped from udevtest, with a libata PATA driver.

run_program: '/lib/udev/scsi_id' (stdout) 'ID_MODEL=WDC_WD400BB-00DE'

I have worked around it by duplicating and modifying my custom rules
but this can be quite jarring when transitioning between the old
and new ATA drivers. udev labeling without suprises is a key
for a smooth migration.

If more information is required let me know.
Comment 1 Matthias Schwarzott gentoo-dev 2007-01-22 14:37:27 UTC
Looking into udev-104:
ata_id.c contains (cut down):
  char model[41];
  set_str(model, (char *) id.model, 40);
  printf("ID_MODEL=%s\n", model);
The original struct id of type hd_driveid also has space for 40 chars.


scsi_id.c contains on the other hand:
  static char model_str[64];
  model = sysfs_attr_get_value(dev_scsi->devpath, "model");
  set_str(model_str, model, sizeof(model_str)-1);
  printf("ID_MODEL=%s\n", model_str);

So both should get around with more than 16 chars.

Can you check what your sysfs contains by (using correct device-name):
cat /sys/block/sda/device/model
Comment 2 Mike Mattie 2007-01-24 06:19:23 UTC
> Can you check what your sysfs contains by (using correct device-name):
> cat /sys/block/sda/device/model

cat /sys/block/sda/device/model:                       
WDC WD400BB-00DE
Comment 3 Mike Mattie 2007-01-24 06:43:47 UTC
A couple more bits of info that may be useful. The two kernels I have tested with
is a 2.6.18.4 (vanilla) with the old IDE driver.

The PATA kernel is 2.6.19 mostly vanilla. 

Linux reforged 2.6.19 #2 PREEMPT Sun Jan 14 03:58:23 PST 2007 i686 AMD Athlon(tm) XP 3000+ AuthenticAMD GNU/Linux

upon examining the dmesg output the truncation is uniform from device detection.

[   41.288284] pata_via 0000:00:0f.0: version 0.1.14
[   41.300048] scsi0 : pata_via
[   41.941604] scsi1 : pata_via

[   42.115575] scsi 0:0:0:0: Direct-Access     ATA      WDC WD400BB-00DE 05.0 PQ
: 0 ANSI: 5
Comment 4 Matthias Schwarzott gentoo-dev 2007-01-27 12:59:22 UTC
(In reply to comment #2)
> > Can you check what your sysfs contains by (using correct device-name):
> > cat /sys/block/sda/device/model
> 
> cat /sys/block/sda/device/model:                       
> WDC WD400BB-00DE
> 
As kernel delivers truncated model-attribute I cannot see how this is a bug in udev and not the kernel.
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2007-04-25 15:22:42 UTC
Created attachment 117231 [details, diff]
diagnostic patch

please apply this patch and attach full dmesg output after booting the patched kernel
Comment 6 Mike Mattie 2007-04-26 05:28:26 UTC
Created attachment 117292 [details]
pata output from 2.7.21-rc7

I applied the diagnostic patch to 2.6.21-rc7 or so. For the sake of honesty
I have RSDL v46 patched in too. That should not affect this at all. If you
want a clean upstream for output I will build a new one.

The first line is "test" , this is because I needed to check the network
connection ( a nc pipe ) before I transferred the dmesg output to the
laptop.

Let me know if you need anymore info, I was just to busy with some other kernel issues (not scheduler) to put this on my front-burner. I know someone else is going to get hit hard by this problem though.
Comment 7 Mike Mattie 2007-04-26 05:34:52 UTC
just to reconfirm the issue. This is output from 2.6.21

from hdparm -i /dev/sda

/dev/sda:

Model=WDC WD400BB-00DEA0
SerialNo=WD-WMAD12027356

from udevinfo /sys/block/sda

udevinfo --query=all --path /sys/block/sda
P: /block/sda
N: sda
S: disk/by-id/scsi-SATA_WDC_WD400BB-00DWD-WMAD12027356
S: disk/by-path/pci-0000:00:0f.0-scsi-0:0:0:0
S: sysdisk/dev-image
E: IN_HOTPLUG=1
E: ID_VENDOR=ATA
E: ID_MODEL=WDC_WD400BB-00DE
E: ID_REVISION=05.0
E: ID_SERIAL=SATA_WDC_WD400BB-00DWD-WMAD12027356
E: ID_SERIAL_SHORT=WD-WMAD12027356
E: ID_TYPE=disk
E: ID_BUS=scsi
E: ID_PATH=pci-0000:00:0f.0-scsi-0:0:0:0
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2007-04-26 14:04:00 UTC
Unfortunately this can't be fixed right now.

libata emulates ATA devices as SCSI devices. The SCSI inquiry data format places a 16 byte limit on model number, whereas the ATA limit is longer.

This will be fixed in the future when libata is made independent from SCSI, but this probably won't be any time soon. For now we'll have to live with it as a known deficiency. Sorry for any inconvenience...
Comment 9 Daniel Drake (RETIRED) gentoo-dev 2007-04-27 12:54:55 UTC
That particular sysfs field will not be fixed but zzam has pointed out that udev has been modified to retrieve the information another way: https://bugzilla.novell.com/show_bug.cgi?id=255413

So, if you upgrade to udev-109 and linux 2.6.21, your links should be correct again. thanks zzam.