Re: problem with duplicate sysfs directories and files

From: Andrew Morton
Date: Wed Mar 08 2006 - 04:01:50 EST


Greg KH <greg@xxxxxxxxx> wrote:
>
> Hi,
>
> I spent some time tonight trying to track down how to fix the issue of
> duplicate sysfs files and/or directories. This happens when you try to
> create a kobject with the same name in the same directory. The creation
> of the second kobject will fail, but the directory will remain in sysfs.
>
> Now I know this isn't a normal operation, but it would be good to fix
> this eventually. I traced the issue down to fs/sysfs/dir.c:create_dir()
> and the check for:
> if (error && (error != -EEXIST)) {
>
> Problem is, error is set to -EEXIST, so we don't clean up properly. Now
> I know we can't just not check for this, as if you do that error
> cleanup, the original kobject's sysfs entry gets very messed up (ls -l
> does not like it at all...)
>
> But I can't seem to figure out what exactly we need to do to clean up
> properly here.
>
> Do you, or anyone else, have any pointers or ideas?
>

Emit a loud warning and don't bother cleaning up - leave the current
behaviour as-is. Whatever takes the least amount code and has the minimum
end-user impact, IMO.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/