From: Mike Snitzer <snitzer@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: dm-devel@redhat.com
Subject: [PATCH] dm: fix blk-mq request-based DM queue initialization
Date: Tue, 28 Apr 2015 20:59:13 -0400 [thread overview]
Message-ID: <1430269153-647-1-git-send-email-snitzer@redhat.com> (raw)
In-Reply-To: <20150425092358.GA15550@infradead.org>
Commit bfebd1cdb4 ("dm: add full blk-mq support to request-based DM")
didn't properly account for the need to short-circuit re-initializing
DM's blk-mq request_queue if it was already initialized.
Fix dm_init_request_based_blk_mq_queue() to return early if the
mapped_device's tag_set already has its driver_data set to the
mapped_device pointer.
Otherwise, reloading a blk-mq request-based DM table (either manually or
via multipathd) resulted in errors like the following:
WARNING: CPU: 9 PID: 2836 at lib/list_debug.c:36 __list_add+0x92/0xc0()
...
kobject (ffff880035625fd0): tried to init an initialized object, something is seriously wrong.
...
sysfs: cannot create duplicate filename '/devices/virtual/block/dm-13/mq'
...
kobject_add_internal failed for mq with -EEXIST, don't try to register things with the same name in the same directory.
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/dm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 1567f6c..c834a94 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2704,6 +2704,9 @@ static int dm_init_request_based_blk_mq_queue(struct mapped_device *md)
struct request_queue *q;
int err;
+ if (md->tag_set.driver_data == md)
+ return 0;
+
memset(&md->tag_set, 0, sizeof(md->tag_set));
md->tag_set.ops = &dm_mq_ops;
md->tag_set.queue_depth = BLKDEV_MAX_RQ;
@@ -2719,7 +2722,7 @@ static int dm_init_request_based_blk_mq_queue(struct mapped_device *md)
err = blk_mq_alloc_tag_set(&md->tag_set);
if (err)
- return err;
+ goto out;
q = blk_mq_init_allocated_queue(&md->tag_set, md->queue);
if (IS_ERR(q)) {
@@ -2739,6 +2742,8 @@ static int dm_init_request_based_blk_mq_queue(struct mapped_device *md)
out_tag_set:
blk_mq_free_tag_set(&md->tag_set);
+out:
+ memset(&md->tag_set, 0, sizeof(md->tag_set));
return err;
}
--
2.3.2 (Apple Git-55)
next prev parent reply other threads:[~2015-04-29 0:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-25 9:23 CONFIG_DM_MQ_DEFAULT makes my kernel unhappy Christoph Hellwig
2015-04-25 15:28 ` Mike Snitzer
2015-04-25 15:37 ` Christoph Hellwig
2015-04-26 14:16 ` Christoph Hellwig
2015-04-27 15:59 ` Mike Snitzer
2015-04-27 16:03 ` Christoph Hellwig
2015-04-27 19:03 ` Mike Snitzer
2015-04-29 0:59 ` Mike Snitzer [this message]
2015-04-29 13:00 ` [PATCH] dm: fix blk-mq request-based DM queue initialization Christoph Hellwig
2015-04-30 1:41 ` Mike Snitzer
2015-04-30 7:22 ` Christoph Hellwig
2015-04-30 8:23 ` Christoph Hellwig
2015-04-30 12:47 ` Mike Snitzer
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=1430269153-647-1-git-send-email-snitzer@redhat.com \
--to=snitzer@redhat.com \
--cc=dm-devel@redhat.com \
--cc=hch@lst.de \
/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