Re: [PATCH 2.6] sysfs_remove_dir

From: Patrick Mochel
Date: Fri Sep 19 2003 - 18:09:44 EST



> sysfs_remove_dir() does not remove the contents of subdirs corresponding
> to the attribute groups of a kobject. The following patch fixes this by first
> removing the subdir contents and then removing thus emptied subdirs along
> with the other attribute files of the kobject and plugs the memory
> leakage resulting from orphan dentries.
>
> I tested it by inserting and removing "dummy.o" network module and verifying
> that dentires corresponding to "statistics" attribute group are removed.

Sorry it's taken a while to reply, but I even now haven't had a chance to
look that deep into this problem. I will say that this is the wrong
approach to the problem.

Upon initial inspection, it looks like it will do the right thing in all
cases, except when a parent is removed before a child is (but we don't
technically support that now).

However, I'd like to move away from the automatic cleanup that sysfs was
doing. attribute groups make it easier to clean up all the files that are
created for an object when the object is removed. I would like to see that
removal call inserted where necessary, instead of adding this complication
to the sysfs core.

I intend to remove the automatic cleanup in sysfs_remove_dir(), but
haven't gotten around to it..

Thanks,



Pat

-
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/