]> git.hungrycats.org Git - linux/commit
block: always verify unfreeze lock on the owner task
authorMing Lei <ming.lei@redhat.com>
Thu, 31 Oct 2024 13:37:19 +0000 (21:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:34 +0000 (13:54 +0100)
commit6655172e54f87af43a1cc0612c6c860d62e8e72c
treea0f0f96c0bb726bca56b1130d4e6ed450362808b
parent54baa8fb084291db648946ba97228315aaa6fafe
block: always verify unfreeze lock on the owner task

commit 6a78699838a0ddeed3620ddf50c1521f1fe1e811 upstream.

commit f1be1788a32e ("block: model freeze & enter queue as lock for
supporting lockdep") tries to apply lockdep for verifying freeze &
unfreeze. However, the verification is only done the outmost freeze and
unfreeze. This way is actually not correct because q->mq_freeze_depth
still may drop to zero on other task instead of the freeze owner task.

Fix this issue by always verifying the last unfreeze lock on the owner
task context, and make sure both the outmost freeze & unfreeze are
verified in the current task.

Fixes: f1be1788a32e ("block: model freeze & enter queue as lock for supporting lockdep")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20241031133723.303835-4-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-core.c
block/blk-mq.c
block/blk.h
include/linux/blkdev.h