From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: wait_for_sysfs messages (more debugging info)
Date: Sat, 16 Oct 2004 02:40:51 +0000 [thread overview]
Message-ID: <20041016024051.GA2950@vrfy.org> (raw)
In-Reply-To: <416F09EE.9050205@gwi.net>
[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]
On Fri, Oct 15, 2004 at 10:00:47PM -0400, Jeff wrote:
> Kay Sievers wrote:
> >On Fri, 2004-10-15 at 01:42 +0200, Kay Sievers wrote:
> >
> >>On Thu, Oct 14, 2004 at 07:21:18PM -0400, Jeff wrote:
> >>
> >>>Sorry to double post but thought with the more verbose debugging this
> >>>might help you more:
> >>>Oct 14 16:04:00 [wait_for_sysfs] either wait_for_sysfs (udev 038) needs
> >>>an update
> >>>to handle the device '/class/vc/vcs2' properly (4) or the sysfs-support
> >>>of your de
> >>>vice's driver needs to be fixed, please report to
> >>><linux-hotplug-devel@lists.sourc
> >>>eforge.net>
> >>
> >>Seems like you have the /etc/hotplug.d/default/00-wait_for_sysfs.hotplug
> >>symlink still installed. Removing this will cut the messages to the
> >>half but not solve the problem, sorry. We are working on it, but currently
> >>have absolutely no idea what's going wrong here.
> >
> >
> >Sorry for the confusion. It seems that the kernel emits two events for
> >every device, which is wrong. It's not a second symlink as I pointed out
> >to you first.
> >
> >Thanks,
> >Kay
> >
> >
> >
> Just an update-039 fixes the majority of the vcs messages. I've rebooted
> a few times and now only get 1-3 of the messages. Example:
>
> Oct 15 21:46:28 [wait_for_sysfs] either wait_for_sysfs (udev 039) needs
> an updat
> e to handle the device '/class/vc/vcs8' properly (3) or the
> sysfs-support of you
> r device's driver needs to be fixed, please report to
> <linux-hotplug-devel@lists
> .sourceforge.net>
>
> Always (3)'s now, no (4)'s (not that I'm really sure what that signifies).
Ok, we need to cover the case, we can open the device but can't read
anything, cause it's gone in the meantime.
Here is a fix and it replaces the magic numbers with meaningful text.
Kay
[-- Attachment #2: wait-error-log.patch --]
[-- Type: text/plain, Size: 4349 bytes --]
===== wait_for_sysfs.c 1.20 vs edited =====
--- 1.20/wait_for_sysfs.c 2004-10-15 23:54:11 +02:00
+++ edited/wait_for_sysfs.c 2004-10-16 04:36:42 +02:00
@@ -56,7 +56,8 @@
#define WAIT_LOOP_PER_SECOND 20
/* wait for specific file to show up, normally the "dev"-file */
-static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev)
+static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev,
+ const char **error)
{
static struct class_file {
char *subsystem;
@@ -103,7 +104,8 @@
struct stat stats;
if (stat(class_dev->path, &stats) == -1) {
- dbg("oops, the directory '%s' just disappeared.", class_dev->path);
+ dbg("we've opened the device '%s' but now it disappeared", class_dev->path);
+ *error = "device directory unavailable";
return -ENODEV;
}
@@ -116,6 +118,7 @@
}
dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file);
+ *error = "class specific file unavailable";
return -ENOENT;
}
@@ -226,7 +229,8 @@
}
/* wait for the bus and for a bus specific file to show up */
-static int wait_for_bus_device(struct sysfs_device *device_dev)
+static int wait_for_bus_device(struct sysfs_device *device_dev,
+ const char **error)
{
static struct bus_file {
char *bus;
@@ -256,6 +260,7 @@
}
if (loop == 0) {
dbg("error: getting /bus-device link");
+ *error = "no /bus-device link";
return -1;
}
dbg("/bus-device link found for bus '%s'", device_dev->bus);
@@ -276,6 +281,7 @@
}
}
if (found == 0) {
+ *error = "unknown bus";
info("error: unknown bus, please report to "
"<linux-hotplug-devel@lists.sourceforge.net> '%s'", device_dev->bus);
return -1;
@@ -284,6 +290,7 @@
}
dbg("error: getting bus '%s' specific file '%s'", device_dev->bus, busfile->file);
+ *error = "bus specific file unavailable";
return -1;
}
@@ -299,7 +306,7 @@
struct sysfs_device *device_dev = NULL;
int loop;
int retval;
- int rc = 0;
+ const char *error = NULL;
init_logging("wait_for_sysfs");
@@ -345,22 +352,19 @@
}
if (class_dev == NULL) {
dbg("error: getting class_device");
- rc = 3;
+ error = "device unavailable";
goto exit;
}
dbg("class_device opened '%s'", filename);
- retval = wait_for_class_device_attributes(class_dev);
- if (retval == -ENODEV)
+ retval = wait_for_class_device_attributes(class_dev, &error);
+ if (retval != 0)
goto exit_class;
- if (retval != 0) {
- rc = 4;
- goto exit_class;
- }
/* skip devices without /device-link */
if (class_device_expect_no_device_link(class_dev)) {
dbg("no device symlink expected for '%s', ", class_dev->name);
+ error = "no device symlink";
goto exit_class;
}
@@ -384,8 +388,7 @@
usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
}
if (device_dev == NULL) {
- dbg("error: getting /device-device");
- rc = 5;
+ error = "error: /device-device symlink";
goto exit_class;
}
dbg("device symlink found pointing to '%s'", device_dev->path);
@@ -394,8 +397,7 @@
if (class_device_expect_no_bus(class_dev)) {
dbg("no bus device expected for '%s', ", class_dev->classname);
} else {
- if (wait_for_bus_device(device_dev) != 0)
- rc = 6;
+ wait_for_bus_device(device_dev, &error);
}
exit_class:
@@ -415,15 +417,13 @@
usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
}
if (device_dev == NULL) {
- dbg("error: getting /device-device");
- rc = 7;
+ error = "error: opening /device-device";
goto exit;
}
dbg("device_device opened '%s'", filename);
/* wait for the bus value */
- if (wait_for_bus_device(device_dev) != 0)
- rc = 8;
+ wait_for_bus_device(device_dev, &error);
sysfs_close_device(device_dev);
@@ -432,13 +432,13 @@
}
exit:
- if (rc == 0)
+ if (error == NULL)
dbg("result: waiting for sysfs successful '%s'", devpath);
else
info("either wait_for_sysfs (udev %s) needs an update to handle the device '%s' "
- "properly (%d) or the sysfs-support of your device's driver needs to be fixed, "
+ "properly (%s) or the sysfs-support of your device's driver needs to be fixed, "
"please report to <linux-hotplug-devel@lists.sourceforge.net>",
- UDEV_VERSION, devpath, rc);
+ UDEV_VERSION, devpath, error);
- return rc;
+ return 3;
}
next prev parent reply other threads:[~2004-10-16 2:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-14 23:21 wait_for_sysfs messages (more debugging info) Jeff
2004-10-15 2:53 ` Jesse Stockall
2004-10-16 2:00 ` Jeff
2004-10-16 2:40 ` Kay Sievers [this message]
2004-10-16 16:26 ` Kay Sievers
2004-10-16 18:48 ` Jeff
2004-10-17 0:45 ` Kay Sievers
2004-10-17 1:55 ` Jeff
2004-10-17 14:04 ` Jeff
2004-10-18 17:17 ` Greg KH
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=20041016024051.GA2950@vrfy.org \
--to=kay.sievers@vrfy.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).