Commit 71ef124d authored by Yu Kuai's avatar Yu Kuai
Browse files

blk-mq: fix lockdep hardirq warning in __blk_mq_tag_idle()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAVONP


CVE: NA

--------------------------------

commit c6f9c0e2 ("blk-mq: allow hardware queue to get more tag
while sharing a tag set") started to call blk_mq_tag_idle() from
hardirq context. And later commit 1b6433f0 ("blk-mq: fix potential io
hang by wrong 'wake_batch'") add spin_unlock_irq() in blk_mq_tag_idle(),
which may enable interrupt in hardirq context, and may trigger AA deadlock.

Fixes: 1b6433f0 ("blk-mq: fix potential io hang by wrong 'wake_batch'")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
parent c9c7afae
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
{
	struct blk_mq_tags *tags = hctx->tags;
	unsigned int users;
	unsigned long flags;

	if (blk_mq_is_sbitmap_shared(hctx->flags)) {
		struct request_queue *q = hctx->queue;
@@ -97,10 +98,10 @@ void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
			return;
	}

	spin_lock_irq(&tags->lock);
	spin_lock_irqsave(&tags->lock, flags);
	users = atomic_dec_return(&tags->active_queues);
	blk_mq_update_wake_batch(tags, users);
	spin_unlock_irq(&tags->lock);
	spin_unlock_irqrestore(&tags->lock, flags);

	blk_mq_tag_wakeup_all(tags, false);
}