From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carl-Daniel Hailfinger Date: Tue, 23 Mar 2004 11:55:09 +0000 Subject: libsysfs/udev hang Message-Id: <4060259D.4000905@gmx.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hi, while writing an ataraid replacement on top of device mapper, I stumbled upon a freeze in sysfs_close_device which only happens if udev is NOT compiled with DEBUG=true. Test routine (modified udevinfo function) follows: static int print_device_chain(const char *path) { struct sysfs_class_device *class_dev; struct sysfs_class_device *class_dev_parent; struct sysfs_attribute *attr; struct sysfs_device *sysfs_dev; struct sysfs_device *sysfs_dev_parent; struct dlist *cur_attrs; int retval = 0; unsigned int vendor,device,subsystem_vendor,subsystem_device; unsigned long devsize; unsigned char *buf; /* get the class dev */ class_dev = sysfs_open_class_device_path(path); if (class_dev = NULL) { printf("couldn't get the class device\n"); return -1; } cur_attrs = sysfs_get_classdev_attributes(class_dev); /* get device size in 512 byte blocks from 'size' */ buf = sysfs_get_value_from_attributes(cur_attrs, "size"); devsize = strtoul(buf, NULL, 10); /* read the 'dev' file for major/minor*/ buf = sysfs_get_value_from_attributes(cur_attrs, "dev"); printf("device '%s' has size %lu blocks and major:minor %s\n", class_dev->path, devsize, buf); sysfs_close_list(cur_attrs); /* get the device link (if parent exists look here) */ class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent != NULL) { class_dev = class_dev_parent; } sysfs_dev = sysfs_get_classdev_device(class_dev); if (sysfs_dev != NULL) printf("follow the class device's \"device\"\n"); /* look the device chain upwards */ while (sysfs_dev != NULL) { printf("point1\n"); /* open sysfs device directory and print all attributes */ if (strcmp(sysfs_dev->bus, "pci") = 0) { cur_attrs = sysfs_get_device_attributes(sysfs_dev); buf = sysfs_get_value_from_attributes(cur_attrs, "vendor"); vendor = (unsigned int)strtoul(buf + 2, NULL, 16); buf = sysfs_get_value_from_attributes(cur_attrs, "device"); device = (unsigned int)strtoul(buf + 2, NULL, 16); buf = sysfs_get_value_from_attributes(cur_attrs, "subsystem_vendor"); subsystem_vendor = (unsigned int)strtoul(buf + 2, NULL, 16); buf = sysfs_get_value_from_attributes(cur_attrs, "subsystem_device"); subsystem_device = (unsigned int)strtoul(buf + 2, NULL, 16); sysfs_close_list(cur_attrs); printf("device '%s' has vendor %x device %x subvendor %x subdevice %x\n", class_dev->path, vendor, device, subsystem_vendor, subsystem_device); printf("point2\n"); break; } printf("point3\n"); sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); printf("point4\n"); if (sysfs_dev_parent = NULL) break; printf("point5\n"); sysfs_dev = sysfs_dev_parent; printf("point6\n"); } printf("point7\n"); sysfs_close_device(sysfs_dev); printf("point8\n"); exit: return retval; } And if I compile udev with DEBUG=true, it works perfectly. If I compile udev without debugging, it hangs between point7 and point8. Did I make any mistakes in the above routine which trigger the hang? I ask here because the libsysfs version in udev differs from libsysfs 1.0.0. Regards, Carl-Daniel ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ 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