[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <607beb5b-8d54-b795-8a05-76352d7ed863@huaweicloud.com>
Date: Sat, 12 Nov 2022 18:44:37 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Liu Shixin <liushixin2@...wei.com>, Jens Axboe <axboe@...nel.dk>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
"yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH] blk-mq: only unregister sysfs when registration succeeded
Hi,
在 2022/11/12 19:07, Liu Shixin 写道:
> kobject_del() must not be called if kobject_add() has not been called.
> Hence only unregister sysfs when registration succeeded.
>
From what I see, the blk_queue_registered() from caller
blk_unregister_queue() can already prevent that. QUEUE_FLAG_REGISTERED
will only be set if blk_register_queue() succeed.
Thanks,
Kuai
> Signed-off-by: Liu Shixin <liushixin2@...wei.com>
> ---
> block/blk-mq-sysfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
> index 93997d297d42..63f2df2500d9 100644
> --- a/block/blk-mq-sysfs.c
> +++ b/block/blk-mq-sysfs.c
> @@ -279,6 +279,8 @@ void blk_mq_sysfs_unregister(struct gendisk *disk)
> unsigned long i;
>
> lockdep_assert_held(&q->sysfs_dir_lock);
> + if (!q->mq_sysfs_init_done)
> + return;
>
> queue_for_each_hw_ctx(q, hctx, i)
> blk_mq_unregister_hctx(hctx);
>
Powered by blists - more mailing lists