From: Liu Shixin <liushixin2@huawei.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Liu Shixin <liushixin2@huawei.com>
Subject: [PATCH] blk-mq: only unregister sysfs when registration succeeded
Date: Sat, 12 Nov 2022 19:07:54 +0800 [thread overview]
Message-ID: <20221112110754.1109979-1-liushixin2@huawei.com> (raw)
kobject_del() must not be called if kobject_add() has not been called.
Hence only unregister sysfs when registration succeeded.
Signed-off-by: Liu Shixin <liushixin2@huawei.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);
--
2.25.1
next reply other threads:[~2022-11-12 10:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 11:07 Liu Shixin [this message]
2022-11-12 10:44 ` Yu Kuai
2022-11-12 10:57 ` Yu Kuai
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=20221112110754.1109979-1-liushixin2@huawei.com \
--to=liushixin2@huawei.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®