]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: move lockdep_assert_held() into elevator_exit
authorMing Lei <ming.lei@redhat.com>
Wed, 25 Sep 2019 22:23:54 +0000 (06:23 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 26 Sep 2019 06:45:05 +0000 (00:45 -0600)
commit46718724aa7c97b6ccbb6c42634ffe85f8b819d5
treecf92c78c0064fa7b31b0d03baf266a18ed21f5e7
parenta8c95a255342e35d911d551503d367ab58c6bf63
blk-mq: move lockdep_assert_held() into elevator_exit

Commit 48c32f0806b3 ("block: don't hold q->sysfs_lock in elevator_init_mq")
removes q->sysfs_lock from elevator_init_mq(), but forgot to deal with
lockdep_assert_held() called in blk_mq_sched_free_requests() which is
run in failure path of elevator_init_mq().

blk_mq_sched_free_requests() is called in the following 3 functions:

elevator_init_mq()
elevator_exit()
blk_cleanup_queue()

In blk_cleanup_queue(), blk_mq_sched_free_requests() is followed exactly
by 'mutex_lock(&q->sysfs_lock)'.

So moving the lockdep_assert_held() from blk_mq_sched_free_requests()
into elevator_exit() for fixing the report by syzbot.

Reported-by: syzbot+da3b7677bb913dc1b737@syzkaller.appspotmail.com
Fixed: 48c32f0806b3 ("block: don't hold q->sysfs_lock in elevator_init_mq")
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-sched.c
block/blk.h