diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-05 17:38:00 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-07 21:20:11 -0800 |
commit | 35a5fe695b07ae899510ad76fdf0aeaef85fe951 (patch) | |
tree | cc91df4f94e06196faa9bde4c6d5cb50fd94bc07 /lib/kobject.c | |
parent | 89c86a64cd056e283323710c9ddf6f7090a450c8 (diff) | |
download | lwn-35a5fe695b07ae899510ad76fdf0aeaef85fe951.tar.gz lwn-35a5fe695b07ae899510ad76fdf0aeaef85fe951.zip |
kobject: remove kset from sysfs immediately in kset_unregister()
There's no "unlink from sysfs" interface for ksets, so I think callers of
kset_unregister() expect the kset to be removed from sysfs immediately,
without waiting for the last reference to be released.
This patch makes the sysfs removal happen immediately, so the caller may
create a new kset with the same name as soon as kset_unregister() returns.
Without this, every caller has to call "kobject_del(&kset->kobj)" first
unless it knows it will never create a new kset with the same name.
This sometimes shows up on module unload and reload, where the reload fails
because it tries to create a kobject with the same name as one from the
original load that still exists. CONFIG_DEBUG_KOBJECT_RELEASE=y makes this
problem easier to hit.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 1d110dc95db5..98b45bb33c8d 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -855,6 +855,7 @@ void kset_unregister(struct kset *k) { if (!k) return; + kobject_del(&k->kobj); kobject_put(&k->kobj); } |