linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Hou Tao <houtao@huaweicloud.com>,
	Li Lingfeng <lilingfeng3@huawei.com>,
	agk@redhat.com, Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	dm-devel@lists.linux.dev,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-block@vger.kernel.org
Cc: zhengqixing@huawei.com, yangerkun <yangerkun@huawei.com>,
	"zhangyi (F)" <yi.zhang@huawei.com>,
	"chengzhihao1@huawei.com" <chengzhihao1@huawei.com>,
	Li Lingfeng <lilingfeng@huaweicloud.com>,
	"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [bug report] dm: 'tried to init an initialized object' error triggered during device creation
Date: Thu, 31 Jul 2025 09:49:27 +0800	[thread overview]
Message-ID: <09e676c5-8407-a0a6-313c-22fcfee4e488@huaweicloud.com> (raw)
In-Reply-To: <f9c385b3-2426-13a1-bc4b-54c3fb402704@huaweicloud.com>

Hi,

在 2025/07/31 9:28, Hou Tao 写道:
> cc +linux-block
> 
> The disk->queue_kobj is initialized in add_disk() and is uninitialized
> in del_disk(). And it seems that blk_unregister_queue() in del_disk()
> doesn't uninitialize the queue_kobj completely, because it doesn't
> expect the queue_kobj will be added again. I think the right place to
> fix the problem is blk_unregister_queue(). How about just memset the
> queue_kobj as zero after deleting the queue_kobj in blk_unregister_queue() ?

I think it's better to move kobject_init to allocate disk:

1) alloc disk, kobject_init
2) register q, kobject_add
3) unregister q, kobject_del
4) free disk, kobject_put

With this, it's safe to add the kobject again.

Thanks,
Kuai


      reply	other threads:[~2025-07-31  1:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 12:00 [bug report] dm: 'tried to init an initialized object' error triggered during device creation Li Lingfeng
2025-07-31  1:28 ` Hou Tao
2025-07-31  1:49   ` Yu Kuai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09e676c5-8407-a0a6-313c-22fcfee4e488@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=agk@redhat.com \
    --cc=chengzhihao1@huawei.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=houtao@huaweicloud.com \
    --cc=lilingfeng3@huawei.com \
    --cc=lilingfeng@huaweicloud.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    --cc=zhengqixing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).