All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olh@suse.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: inconsistent renaming of devices
Date: Sun, 08 Feb 2004 14:13:23 +0000	[thread overview]
Message-ID: <20040208141323.GA24211@suse.de> (raw)
In-Reply-To: <marc-linux-hotplug-107165372413670@msgid-missing>

 On Thu, Feb 05, Greg KH wrote:

> On Thu, Feb 05, 2004 at 10:56:45AM +0100, Olaf Hering wrote:
> >  On Thu, Feb 05, Greg KH wrote:
> > 
> > > On Thu, Feb 05, 2004 at 11:58:53AM +0530, Surekha.PC wrote:
> > > > 
> > > > Hi,
> > > > 
> > > >  Has this problem been fixed in udev? I installed the latest udev-016
> > > > package and device naming inconsistenty persists.
> > > 
> > > Yes, it should be fixed.
> > > 
> > > What do you see happening in your system?
> > > If you build with DEBUG=true USE_LOG=true what does the debug syslog
> > > show for these devices?
> > 
> > It is probalby the same sort of race that I reported earlier this week.
> 
> Do you mean the permisions one?  That's all I remember seeing.  If not,
> please let me know.

No, that was about that fact that block (and scsi) events run much
earlier than expected. The properties below /block/sda/device/ and
/sys/bus/*/devices/$bus_id appear to late, the result is that the
BUS="scsi" rule doesnt match and it falls through to the BUS="usb" rule.
I have to add sleep 3 in case of my USB stick.

It would make sense to run the /block/sda event just before the
/block/sda/sda1 event (if there is a partition table). sda1 has always
all properties in /block/sda/sda1/../device/

sysfs_path_is_link() does a stat(/sys/bus/*/devices/$bus_id) and this does
not exist.

Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/scsi/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/ieee1394/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/usb/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/ide/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/macio/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/pci/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/of_platform/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: sysfs_path_is_link: stat(/sys/bus/platform/devices/15:0:0:0) failed
Feb  8 14:36:33 ibook udev[12643]: get_sysfs_device: timed out waiting to find the device bus, continuing on anyway
Feb  8 14:36:33 ibook udev[12643]: namedev_name_device: sysfs_device->path='/sys/devices/pci0001:01/0001:01:18.0/usb1/1-1/1-1:1.0/host15/15:0:0:0'
Feb  8 14:36:33 ibook udev[12643]: namedev_name_device: sysfs_device->bus_id='15:0:0:0'
Feb  8 14:36:33 ibook udev[12643]: namedev_name_device: sysfs_device->bus=''
Feb  8 14:36:33 ibook udev[12643]: wait_for_device_to_initialize: did not find bus type '' on list of bus_id_files, contact greg@kroah.com
Feb  8 14:36:33 ibook udev[12643]: namedev_name_device: kernel_number=''
Feb  8 14:36:33 ibook udev[12643]: namedev_name_device: process rule
Feb  8 14:36:33 ibook udev[12643]: match_rule: check for BUS dev->bus='scsi' sysfs_device->bus=''
Feb  8 14:36:33 ibook udev[12643]: match_rule: BUS is not matching

Now, this little hack, and the result looks much better.

--- udev-glibc/libsysfs/sysfs_device.c  2004-01-17 02:42:37.000000000 +0100
+++ udev-glibc-debug/libsysfs/sysfs_device.c    2004-02-08 15:06:10.738209173 +0100
@@ -34,6 +34,7 @@ int sysfs_get_device_bus(struct sysfs_de
        unsigned char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX];
        unsigned char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL;
        struct dlist *buslist = NULL;
+       int retries;
 
        if (dev = NULL) {
                errno = EINVAL;
@@ -44,6 +45,8 @@ int sysfs_get_device_bus(struct sysfs_de
        strcat(subsys, "/");
        strcpy(subsys, SYSFS_BUS_NAME);  /* subsys = /bus */
        buslist = sysfs_open_subsystem_list(subsys);
+       retries = 5;
+retry:
        if (buslist != NULL) {
                dlist_for_each_data(buslist, bus, char) {
                        memset(path, 0, SYSFS_PATH_MAX);
@@ -79,6 +82,12 @@ int sysfs_get_device_bus(struct sysfs_de
                                }
                        }
                 }
+               if(--retries) {
+                       dprintf("sleep one second for %s\n", dev->bus_id);
+                       sleep(1);
+                       dprintf("retries left: %d\n", retries);
+                       goto retry;
+               }
                 sysfs_close_list(buslist);
         }
         return -1;



Feb  8 15:06:46 ibook udev[16851]: main: version 016_bk
Feb  8 15:06:46 ibook udev[16851]: udev_hotplug: looking at '/block/sda'
Feb  8 15:06:46 ibook udev[16851]: get_dirs: sysfs_path='/sys'
Feb  8 15:06:46 ibook udev[16851]: parse_config_file: reading '/etc/udev/udev.conf' as config file
Feb  8 15:06:46 ibook udev[16851]: namedev_init_rules: reading '/etc/udev/udev.rules' as rules file
Feb  8 15:06:46 ibook udev[16851]: namedev_init_permissions: reading '/etc/udev/udev.permissions' as permissions file
Feb  8 15:06:46 ibook udev[16851]: sleep_for_dev: looking for '/sys/block/sda/dev'
Feb  8 15:06:46 ibook udev[16851]: get_class_dev: looking at '/sys/block/sda'
Feb  8 15:06:46 ibook udev[16851]: get_class_dev: class_dev->name='sda'
Feb  8 15:06:46 ibook udev[16851]: get_major_minor: dev='8:0 '
Feb  8 15:06:46 ibook udev[16851]: get_major_minor: found major=8, minor=0
Feb  8 15:06:46 ibook udev[16851]: get_blockdev_parent: sda not a partition
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/scsi/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/ieee1394/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/usb/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/ide/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/macio/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/pci/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/of_platform/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/platform/devices/23:0:0:0) failed
Feb  8 15:06:46 ibook udev[16851]: sysfs_get_device_bus: sleep one second for 23:0:0:0
Feb  8 15:06:47 ibook udev[16851]: sysfs_get_device_bus: retries left: 4
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/scsi/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/ieee1394/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/usb/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/ide/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/macio/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/pci/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/of_platform/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/platform/devices/23:0:0:0) failed
Feb  8 15:06:47 ibook udev[16851]: sysfs_get_device_bus: sleep one second for 23:0:0:0
Feb  8 15:06:48 ibook udev[16851]: sysfs_get_device_bus: retries left: 3
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/scsi/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/ieee1394/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/usb/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/ide/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/macio/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/pci/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/of_platform/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_path_is_link: stat(/sys/bus/platform/devices/23:0:0:0) failed
Feb  8 15:06:48 ibook udev[16851]: sysfs_get_device_bus: sleep one second for 23:0:0:0
Feb  8 15:06:49 ibook udev[16851]: sysfs_get_device_bus: retries left: 2
Feb  8 15:06:49 ibook udev[16851]: get_sysfs_device: device 23:0:0:0 is registered with bus 'scsi'
Feb  8 15:06:49 ibook udev[16851]: namedev_name_device: sysfs_device->path='/sys/devices/pci0001:01/0001:01:18.0/usb1/1-1/1-1:1.0/host23/23:0:0:0'
Feb  8 15:06:49 ibook udev[16851]: namedev_name_device: sysfs_device->bus_id='23:0:0:0'
Feb  8 15:06:49 ibook udev[16851]: namedev_name_device: sysfs_device->bus='scsi'
Feb  8 15:06:49 ibook udev[16851]: wait_for_device_to_initialize: looking for file 'vendor' on bus 'scsi'
Feb  8 15:06:49 ibook udev[16851]: namedev_name_device: kernel_number=''
Feb  8 15:06:49 ibook udev[16851]: namedev_name_device: process rule
Feb  8 15:06:49 ibook udev[16851]: match_rule: check for BUS dev->bus='scsi' sysfs_device->bus='scsi'
Feb  8 15:06:49 ibook udev[16851]: match_rule: BUS matches


> I still need to try to track down that permissions problem...

Could be a dietlibc problem. Havent look closer yet.

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-02-08 14:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17  9:33 inconsistent renaming of devices Martin Lorenz
2003-12-17 18:13 ` Greg KH
2004-02-05  6:40 ` Surekha.PC
2004-02-05  8:56 ` Greg KH
2004-02-05  9:56 ` Olaf Hering
2004-02-05 10:11 ` Surekha.PC
2004-02-05 23:49 ` Greg KH
2004-02-05 23:51 ` Greg KH
2004-02-06  0:18 ` Kay Sievers
2004-02-06  6:34 ` Surekha.PC
2004-02-06  9:18 ` 'Kay Sievers'
2004-02-06 11:29 ` Surekha.PC
2004-02-08 14:13 ` Olaf Hering [this message]
2004-02-09  5:51 ` Ananth N Mavinakayanahalli
2004-02-09  6:31 ` Olaf Hering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040208141323.GA24211@suse.de \
    --to=olh@suse.de \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.