{"action":"created","issue":{"url":"https://api.github.com/repos/systemd/systemd/issues/3943","repository_url":"https://api.github.com/repos/systemd/systemd","labels_url":"https://api.github.com/repos/systemd/systemd/issues/3943/labels{/name}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/3943/comments","events_url":"https://api.github.com/repos/systemd/systemd/issues/3943/events","html_url":"https://github.com/systemd/systemd/issues/3943","id":170711950,"number":3943,"title":"udev assigns all disks behind a single SATA port multiplier port the same ID_PATH","user":{"login":"siebenmann","id":865382,"avatar_url":"https://avatars.githubusercontent.com/u/865382?v=3","gravatar_id":"","url":"https://api.github.com/users/siebenmann","html_url":"https://github.com/siebenmann","followers_url":"https://api.github.com/users/siebenmann/followers","following_url":"https://api.github.com/users/siebenmann/following{/other_user}","gists_url":"https://api.github.com/users/siebenmann/gists{/gist_id}","starred_url":"https://api.github.com/users/siebenmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siebenmann/subscriptions","organizations_url":"https://api.github.com/users/siebenmann/orgs","repos_url":"https://api.github.com/users/siebenmann/repos","events_url":"https://api.github.com/users/siebenmann/events{/privacy}","received_events_url":"https://api.github.com/users/siebenmann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/systemd/systemd/labels/needs-new-home","name":"needs-new-home","color":"e11d21"},{"url":"https://api.github.com/repos/systemd/systemd/labels/udev","name":"udev","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2016-08-11T18:21:18Z","updated_at":"2016-09-13T18:56:20Z","closed_at":null,"body":"### Submission type\r\n\r\n  - [x] Bug report\r\n  - [ ] Request for enhancement (RFE)\r\n\r\n### systemd version the issue has been seen with\r\n\r\n> 231\r\n\r\nVersion 231 from a recent Ubuntu 'yakkety' pre-release ISO image. The bug was originally seen with Ubuntu 16.04's 229, and the code in question is unchanged since September 2015 or so. The Ubuntu bug is [bug 1611945](https://bugs.launchpad.net/bugs/1611945).\r\n\r\n### Used distribution\r\n\r\n> Ubuntu yakkety (in development), Ubuntu 16.04\r\n\r\n### Bug description\r\n\r\nWe have servers with external SATA disk enclosures, connected through (e)SATA port multiplier ports. On recent kernels and systemd versions, /dev/disk/by-path is not correctly populated with symlinks for all disks; instead we see a symlink to only one disk on each port. The direct cause for this is that udev is assigning the same ID_PATH name (and related other values) to all disks on the same port, and only one out of them can actually get the name. Specifically, all of the disks on a single port get the name of, eg, pci-0000:02:00.0-ata-1 (in this case, for all disks on the first port on the controller; on the second port, it's -ata-2, and so on).\r\n\r\nBased on code inspection, the underlying issue is that `handle_scsi_ata()` in src/udev/udev-builtin-path_id.c is not aware that multiple disks can be behind a single ATA port. The only thing it puts in the ID_PATH is the ATA port number ('port_no'), which is the same for all disks behind the port.\r\n\r\nOur machines previously did not have this issue in Ubuntu 12.04 because in 12.04, the kernel did not clearly identify these disks as ATA disks in their sysfs path. In 12.04, such a disk showed up with the sysfs path of /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:00.0/host8/target8:0:0/8:0:0:0/block/sdk. In 16.04's kernel, the same enclosure slot has the sysfs path of /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:00.0/ata1/host0/target0:0:0/0:0:0:0/block/sda. The presence of '/ata' in this path triggers udev's ATA-specific handling code, whereas in 12.04 the disks were handled by the generic SCSI code.\r\n\r\n### In case of bug report: Expected behaviour you didn't see\r\n\r\n> All disks present in /dev/disk/by-path/.\r\n\r\n### In case of bug report: Unexpected behaviour you saw\r\n\r\n> Only one out of four disks on each port multiplier port being visible in /dev/disk/by-path.\r\n\r\nIn fact we can sometimes see inconsistencies in what disk gets what symlink. For instance, here is part of a ls -l:\r\n\r\n```\r\nlrwxrwxrwx 1 root root  9 Aug 11 16:32 pci-0000:02:00.0-ata-2 -> ../../sdi\r\nlrwxrwxrwx 1 root root 10 Aug 11 16:32 pci-0000:02:00.0-ata-2-part1 -> ../../sdi1\r\nlrwxrwxrwx 1 root root  9 Aug 11 16:32 pci-0000:02:00.0-ata-3 -> ../../sdk\r\nlrwxrwxrwx 1 root root 10 Aug 11 16:32 pci-0000:02:00.0-ata-3-part1 -> ../../sdm1\r\n```\r\n\r\nHere -ata-2 and ata-2-part1 point to the same disk (sdi and sdi1), but -ata-3 and -ata-3-part1 point to different disks; sdk has won the contest to be -ata-3, but sdm1 has won for -ata-3-part1. This is not surprising since udev explicitly says the behavior of multiple devices being assigned the same name is unspecified, but it does show that there is a problem.\r\n\r\n### In case of bug report: Steps to reproduce the problem\r\n\r\n> Boot a system with SATA port multiplier support and multiple disks connected to the same port, and observe /dev/disk/by-path not having all of them.\r\n\r\n### Additional data\r\n\r\nI have a certain amount of data gathered from systemd 231 on our machine; this includes things like 'udevadm info --export-db' output, 'udevadm test <device>' for some devices, and ls -lR of the PCI hierarchy for a controller (with multiple disks connected to multiple ports). I can attach some or much of that if desired. And if data from systemd 229 (16.04's version) is acceptable we can get basically any additional data that you want, since the machine is installed with that version currently. Just let me know what would be useful.\r\n\r\nWe are probably willing to temporarily run systemd versions with experimental patches/modifications to test fixes to the issue for you (especially given that you may not have easy access to hardware with SATA port multipliers and multiple disks behind a single port), although it is easiest if we can drop the modification into the Ubuntu 16.04 systemd source base."},"comment":{"url":"https://api.github.com/repos/systemd/systemd/issues/comments/246786518","html_url":"https://github.com/systemd/systemd/issues/3943#issuecomment-246786518","issue_url":"https://api.github.com/repos/systemd/systemd/issues/3943","id":246786518,"user":{"login":"sitsofe","id":4005180,"avatar_url":"https://avatars.githubusercontent.com/u/4005180?v=3","gravatar_id":"","url":"https://api.github.com/users/sitsofe","html_url":"https://github.com/sitsofe","followers_url":"https://api.github.com/users/sitsofe/followers","following_url":"https://api.github.com/users/sitsofe/following{/other_user}","gists_url":"https://api.github.com/users/sitsofe/gists{/gist_id}","starred_url":"https://api.github.com/users/sitsofe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sitsofe/subscriptions","organizations_url":"https://api.github.com/users/sitsofe/orgs","repos_url":"https://api.github.com/users/sitsofe/repos","events_url":"https://api.github.com/users/sitsofe/events{/privacy}","received_events_url":"https://api.github.com/users/sitsofe/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T18:56:20Z","updated_at":"2016-09-13T18:56:20Z","body":"@davidmilburn @arvidjaar I know this patch won't be accepted into systemd but could you cast your eyes over it anyway?"}}
{"actor":{"display_login":"sitsofe"}}