From: Greg KH <greg@kroah.com>
To: Amit Shah <amitshah@gmx.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sysfs: WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
Date: Fri, 26 Oct 2007 08:50:58 -0700 [thread overview]
Message-ID: <20071026155058.GC23016@kroah.com> (raw)
In-Reply-To: <877aabc40710260014v220ab804o5de5dbc36b870bd1@mail.gmail.com>
On Fri, Oct 26, 2007 at 12:44:38PM +0530, Amit Shah wrote:
> On 2.6.24-rc1, I get this for all my eth interfaces:
>
> [ 150.389821] sysfs: duplicate filename 'eth1_rename' can not be created
> [ 150.389824] WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
I sent out the patch below for comments, yet no one did :(
Can you try it out and let me know if it works for you or not?
thanks,
greg k-h
------------
From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: kobject: check for duplicate names in kobject_rename
This should catch any duplicate names before we try to tell sysfs to
rename the object. This happens a lot with older versions of udev and
the network rename scripts.
Cc: David Miller <davem@davemloft.net>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
lib/kobject.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -308,6 +308,19 @@ int kobject_rename(struct kobject * kobj
if (!kobj->parent)
return -EINVAL;
+ /* see if this name is already in use */
+ if (kobj->kset) {
+ struct kobject *temp_kobj;
+ temp_kobj = kset_find_obj(kobj->kset, new_name);
+ if (temp_kobj) {
+ printk(KERN_WARNING "kobject '%s' can not be renamed "
+ "to '%s' as '%s' is already in existance.\n",
+ kobject_name(kobj), new_name, new_name);
+ kobject_put(temp_kobj);
+ return -EINVAL;
+ }
+ }
+
devpath = kobject_get_path(kobj, GFP_KERNEL);
if (!devpath) {
error = -ENOMEM;
next prev parent reply other threads:[~2007-10-26 15:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 7:14 sysfs: WARNING: at fs/sysfs/dir.c:424 sysfs_add_one() Amit Shah
2007-10-26 9:17 ` sysfs: WARNING: at fs/sysfs/dir.c:424 sysfs_add_one() - with ALSA Kamalesh Babulal
2007-10-26 15:52 ` Greg KH
2007-10-26 14:18 ` [alsa-devel] " Takashi Iwai
2007-10-26 16:17 ` Kay Sievers
2007-10-26 17:17 ` Kamalesh Babulal
2007-10-26 17:15 ` Kamalesh Babulal
[not found] ` <1193498376.32561.219.camel@razman.gruemaster.com>
2007-10-29 5:45 ` Kamalesh Babulal
2007-10-29 7:30 ` Takashi Iwai
2007-10-30 13:12 ` Takashi Iwai
2007-10-26 15:50 ` Greg KH [this message]
2007-10-26 17:25 ` sysfs: WARNING: at fs/sysfs/dir.c:424 sysfs_add_one() Amit Shah
2007-10-26 19:15 ` Greg KH
2007-10-26 20:25 ` Amit Shah
2007-10-26 20:30 ` Kay Sievers
2007-10-28 7:17 ` Amit Shah
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=20071026155058.GC23016@kroah.com \
--to=greg@kroah.com \
--cc=amitshah@gmx.net \
--cc=linux-kernel@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