Re: 2.6.25-mm1 -- WARNING: at fs/sysfs/dir.c:427 sysfs_add_one+0x33/0x9a()
From: Miles Lane
Date: Mon Apr 21 2008 - 18:01:53 EST
On Mon, Apr 21, 2008 at 5:01 PM, Frederik Deweerdt <deweerdt@xxxxxxx> wrote:
> On Mon, Apr 21, 2008 at 02:56:52PM -0400, Miles Lane wrote:
> > Is anyone interesting in following up on this?
> >
> Doesn't this
> http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-04/msg06990.html
> fixes it?
That patch seems to have some problems:
http://groups.google.com/group/linux.kernel/browse_thread/thread/a9cfeae4ce67ee8e/2118788c3c81b2f3?#2118788c3c81b2f3
Should I apply this instead or as well?
From: Kay Sievers <kay.siev...@xxxxxxxx>
Subject: sysfs: fix duplicated device number registration in /sys/dev/
If the parent device has the same dev_t, we skip the registration
for the device number at /sys/dev.
Cc: Dan Williams <dan.j.willi...@xxxxxxxxx>
Cc: Greg KH <g...@xxxxxxxxx>
ïCc: Andrew Morton <a...@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Kay Sievers <kay.siev...@xxxxxxxx>
---
core.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index de925f8..afedadb 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -821,10 +821,13 @@ int device_add(struct device *dev)
if (error)
goto ueventattrError;
- format_dev_t(devt_str, dev->devt);
- error = sysfs_create_link(kobj, &dev->kobj, devt_str);
- if (error)
- goto devtattrError;
+ /* do not create /sys/dev/ entry if parent already did */
+ if (!(dev->parent && dev->parent->devt == dev->devt)) {
+ format_dev_t(devt_str, dev->devt);
+ error = sysfs_create_link(kobj, &dev->kobj, devt_str);
+ if (error)
+ goto devtattrError;
+ }
}
error = device_add_class_symlinks(dev);
@@ -950,8 +953,10 @@ void device_del(struct device *dev)
if (parent)
klist_del(&dev->knode_parent);
if (MAJOR(dev->devt)) {
- format_dev_t(devt_str, dev->devt);
- sysfs_remove_link(device_to_dev_kobj(dev), devt_str);
+ if (!(parent && parent->devt == dev->devt)) {
+ format_dev_t(devt_str, dev->devt);
+ sysfs_remove_link(device_to_dev_kobj(dev), devt_str);
+ }
device_remove_file(dev, &devt_attr);
}
if (dev->class) {
--
N§²æìr¸yúèØb²X¬¶ÇvØ^)Þ{.nÇ+·¥{±êçzX§¶¡Ü}©²ÆzÚ&j:+v¨¾«êçzZ+Ê+zf£¢·h§~Ûiÿûàz¹®w¥¢¸?¨èÚ&¢)ßfù^jÇy§m
á@A«a¶Úÿ0¶ìh®åi