From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: ming.lei@redhat.com, linux-block@vger.kernel.org
Subject: [PATCH 2/2] Revert "ublk_drv: fix request queue leak"
Date: Mon, 18 Jul 2022 08:29:28 +0200 [thread overview]
Message-ID: <20220718062928.335399-2-hch@lst.de> (raw)
In-Reply-To: <20220718062928.335399-1-hch@lst.de>
This was just a rather broken way to paper over a core block layer bug
that is now fixed.
This reverts commit cebbe577cb17ed9b04b50d9e6802a8bacffbadca.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/ublk_drv.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index b633d268b90ae..4e0248ef6bec5 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -155,8 +155,6 @@ static DEFINE_MUTEX(ublk_ctl_mutex);
static struct miscdevice ublk_misc;
-static struct lock_class_key ublk_bio_compl_lkclass;
-
static inline bool ublk_can_use_task_work(const struct ublk_queue *ubq)
{
if (IS_BUILTIN(CONFIG_BLK_DEV_UBLK) &&
@@ -633,7 +631,7 @@ static void ublk_commit_rqs(struct blk_mq_hw_ctx *hctx)
static int ublk_init_hctx(struct blk_mq_hw_ctx *hctx, void *driver_data,
unsigned int hctx_idx)
{
- struct ublk_device *ub = driver_data;
+ struct ublk_device *ub = hctx->queue->queuedata;
struct ublk_queue *ubq = ublk_get_queue(ub, hctx->queue_num);
hctx->driver_data = ubq;
@@ -1074,8 +1072,6 @@ static void ublk_cdev_rel(struct device *dev)
{
struct ublk_device *ub = container_of(dev, struct ublk_device, cdev_dev);
- blk_mq_destroy_queue(ub->ub_queue);
-
put_disk(ub->ub_disk);
blk_mq_free_tag_set(&ub->tag_set);
@@ -1165,17 +1161,14 @@ static int ublk_add_dev(struct ublk_device *ub)
if (err)
goto out_deinit_queues;
- ub->ub_queue = blk_mq_init_queue(&ub->tag_set);
- if (IS_ERR(ub->ub_queue))
- goto out_cleanup_tags;
- ub->ub_queue->queuedata = ub;
-
- disk = ub->ub_disk = blk_mq_alloc_disk_for_queue(ub->ub_queue,
- &ublk_bio_compl_lkclass);
+ disk = ub->ub_disk = blk_mq_alloc_disk(&ub->tag_set, ub);
if (IS_ERR(disk)) {
err = PTR_ERR(disk);
- goto out_free_request_queue;
+ goto out_cleanup_tags;
}
+ ub->ub_queue = ub->ub_disk->queue;
+
+ ub->ub_queue->queuedata = ub;
blk_queue_logical_block_size(ub->ub_queue, bsize);
blk_queue_physical_block_size(ub->ub_queue, bsize);
@@ -1207,8 +1200,6 @@ static int ublk_add_dev(struct ublk_device *ub)
return 0;
-out_free_request_queue:
- blk_mq_destroy_queue(ub->ub_queue);
out_cleanup_tags:
blk_mq_free_tag_set(&ub->tag_set);
out_deinit_queues:
--
2.30.2
next prev parent reply other threads:[~2022-07-18 6:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 6:29 [PATCH 1/2] block: call blk_mq_exit_queue from disk_release for never added disks Christoph Hellwig
2022-07-18 6:29 ` Christoph Hellwig [this message]
2022-07-19 12:37 ` [PATCH 2/2] Revert "ublk_drv: fix request queue leak" Ming Lei
2022-07-20 6:07 ` Christoph Hellwig
2022-07-20 7:47 ` Ming Lei
2022-07-20 9:00 ` Christoph Hellwig
2022-07-20 10:16 ` Ming Lei
2022-07-20 10:23 ` Ming Lei
2022-07-20 13:08 ` Christoph Hellwig
2022-07-20 15:33 ` Ming Lei
2022-07-21 5:12 ` Christoph Hellwig
2022-07-18 7:18 ` [PATCH 1/2] block: call blk_mq_exit_queue from disk_release for never added disks Ming Lei
2022-07-18 8:33 ` Ming Lei
2022-07-18 13:08 ` Christoph Hellwig
2022-07-18 13:07 ` Christoph Hellwig
2022-07-18 15:16 ` Ming Lei
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=20220718062928.335399-2-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.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).