Re: blk_mq_register_disk: kobject (00000000009f2dd8): tried to init an initialized object, something is seriously wrong.

From: Ming Lei
Date: Mon Sep 21 2015 - 23:35:56 EST


On Mon, Sep 21, 2015 at 7:43 PM, Meelis Roos <mroos@xxxxxxxx> wrote:
>
>
> Yes, sorry - I applied the last chunk by hand because it was mangled by
> the web UI, and added ti to a wrong struct.
>
> Now I tested it on top of 4.3.0-rc1. COmpiles, rebooted fine 6 times,
> but now it hangs again, seems to be the same message:
>
> [ 107.143910] kobject (00000000009f2dd8): tried to init an initialized object, something is seriously wrong.

Looks a bit odd since blk_mq_register_disk is run only once per device,
could you apply the attached debug patch and post the boot log when the
warning is triggered?

Thanks,
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 279c5d6..d09c511 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -403,13 +403,20 @@ static void blk_mq_sysfs_init(struct request_queue *q)
struct blk_mq_ctx *ctx;
int i;

+ printk("%s: init mq_kobj %p\n", __func__, &q->mq_kobj);
kobject_init(&q->mq_kobj, &blk_mq_ktype);

- queue_for_each_hw_ctx(q, hctx, i)
+ queue_for_each_hw_ctx(q, hctx, i) {
+ printk("%s: init hctx_kobj %p %d\n", __func__,
+ &hctx->kobj, i);
kobject_init(&hctx->kobj, &blk_mq_hw_ktype);
+ }

- queue_for_each_ctx(q, ctx, i)
+ queue_for_each_ctx(q, ctx, i) {
+ printk("%s: init ctx_kobj %p %d\n", __func__,
+ &ctx->kobj, i);
kobject_init(&ctx->kobj, &blk_mq_ctx_ktype);
+ }
}

/* see blk_register_queue() */