diff options
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 4a1f33d43548..084f7b18d0c0 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -545,8 +545,8 @@ static void kobject_cleanup(struct kobject *kobj) | |||
545 | struct kobj_type *t = get_ktype(kobj); | 545 | struct kobj_type *t = get_ktype(kobj); |
546 | const char *name = kobj->name; | 546 | const char *name = kobj->name; |
547 | 547 | ||
548 | pr_debug("kobject: '%s' (%p): %s\n", | 548 | pr_debug("kobject: '%s' (%p): %s, parent %p\n", |
549 | kobject_name(kobj), kobj, __func__); | 549 | kobject_name(kobj), kobj, __func__, kobj->parent); |
550 | 550 | ||
551 | if (t && !t->release) | 551 | if (t && !t->release) |
552 | pr_debug("kobject: '%s' (%p): does not have a release() " | 552 | pr_debug("kobject: '%s' (%p): does not have a release() " |
@@ -580,9 +580,25 @@ static void kobject_cleanup(struct kobject *kobj) | |||
580 | } | 580 | } |
581 | } | 581 | } |
582 | 582 | ||
583 | #ifdef CONFIG_DEBUG_KOBJECT_RELEASE | ||
584 | static void kobject_delayed_cleanup(struct work_struct *work) | ||
585 | { | ||
586 | kobject_cleanup(container_of(to_delayed_work(work), | ||
587 | struct kobject, release)); | ||
588 | } | ||
589 | #endif | ||
590 | |||
583 | static void kobject_release(struct kref *kref) | 591 | static void kobject_release(struct kref *kref) |
584 | { | 592 | { |
585 | kobject_cleanup(container_of(kref, struct kobject, kref)); | 593 | struct kobject *kobj = container_of(kref, struct kobject, kref); |
594 | #ifdef CONFIG_DEBUG_KOBJECT_RELEASE | ||
595 | pr_info("kobject: '%s' (%p): %s, parent %p (delayed)\n", | ||
596 | kobject_name(kobj), kobj, __func__, kobj->parent); | ||
597 | INIT_DELAYED_WORK(&kobj->release, kobject_delayed_cleanup); | ||
598 | schedule_delayed_work(&kobj->release, HZ); | ||
599 | #else | ||
600 | kobject_cleanup(kobj); | ||
601 | #endif | ||
586 | } | 602 | } |
587 | 603 | ||
588 | /** | 604 | /** |
@@ -915,6 +931,18 @@ const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj) | |||
915 | return kobj_child_ns_ops(kobj->parent); | 931 | return kobj_child_ns_ops(kobj->parent); |
916 | } | 932 | } |
917 | 933 | ||
934 | bool kobj_ns_current_may_mount(enum kobj_ns_type type) | ||
935 | { | ||
936 | bool may_mount = true; | ||
937 | |||
938 | spin_lock(&kobj_ns_type_lock); | ||
939 | if ((type > KOBJ_NS_TYPE_NONE) && (type < KOBJ_NS_TYPES) && | ||
940 | kobj_ns_ops_tbl[type]) | ||
941 | may_mount = kobj_ns_ops_tbl[type]->current_may_mount(); | ||
942 | spin_unlock(&kobj_ns_type_lock); | ||
943 | |||
944 | return may_mount; | ||
945 | } | ||
918 | 946 | ||
919 | void *kobj_ns_grab_current(enum kobj_ns_type type) | 947 | void *kobj_ns_grab_current(enum kobj_ns_type type) |
920 | { | 948 | { |