From: Jianchao Wang <jianchao.w.wang@oracle.com>
To: axboe@kernel.dk
Cc: bart.vanassche@wdc.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] block: fix the lock inversion caused by kobject_del under sysfs_lock
Date: Fri, 22 Jun 2018 15:11:17 +0800 [thread overview]
Message-ID: <1529651480-1734-1-git-send-email-jianchao.w.wang@oracle.com> (raw)
Hi Jens
Currently, the kobject_del for sysfs mq and hctx entry is invoked
under q->sysfs_lock. lock inversion will came up when someone try
to access the sysfs entries concurrently. The scenario is as below:
hold q->sysfs_lock access mq,hctx sysfs entries
kobject_del
__kernfs_remove kernfs_get_active
kernfs_drain
wait kn->active require q->sysfs_lock
To avoid this issue, kobject_del for mq and hctx sysfs entries
mustn't be inovked under sysfs_lock. These patch set is to achieve this.
1st patch introduces blk_queue_registered to test QUEUE_FLAG_REGISTERED
2nd patch remove blk_mq_register_dev which is usesless.
3rd patch fix the issue by changing the sync method, please refer to the
comment.
Jianchao Wang (3)
block: add helper interface blk_queue_registered
blk-mq: cleanup blk_mq_register_dev
block: fix the lock inversion caused by kobject_del under sysfs_lock
block/blk-mq-sysfs.c | 80 +++++++++++++++++++++++++++++++-------------------
block/blk-mq.h | 3 ++
block/blk-sysfs.c | 43 ++++++++++++++-------------
block/blk-wbt.c | 4 ---
block/elevator.c | 5 ++--
include/linux/blk-mq.h | 3 --
include/linux/blkdev.h | 4 ++-
7 files changed, 82 insertions(+), 60 deletions(-)
Thanks
Jianchao
next reply other threads:[~2018-06-22 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 7:11 Jianchao Wang [this message]
2018-06-22 7:11 ` [PATCH 1/3] block: add helper interface blk_queue_registered Jianchao Wang
2018-06-22 7:11 ` [PATCH 2/3] blk-mq: cleanup blk_mq_register_dev Jianchao Wang
2018-06-22 7:11 ` [PATCH 3/3] block: fix the lock inversion caused by kobject_del under sysfs_lock Jianchao Wang
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=1529651480-1734-1-git-send-email-jianchao.w.wang@oracle.com \
--to=jianchao.w.wang@oracle.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--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;
as well as URLs for NNTP newsgroup(s).