Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f105cda1 authored by Sarthak Garg's avatar Sarthak Garg
Browse files

mmc: core: Fix recursive locking issue with queue_lock



Consider the following stack trace

-001|raw_spin_lock_irqsave
-002|mmc_blk_cqe_complete_rq
-003|__blk_mq_complete_request(inline)
-003|blk_mq_complete_request(rq)
-004|mmc_cqe_timed_out(inline)
-004|mmc_mq_timed_out

mmc_mq_timed_out acquires the queue_lock for the first
time. The mmc_blk_cqe_complete_rq function also tries to acquire
the same queue lock resulting in recursive locking where the task
is spinning for the same lock which it has already acquired leading
to watchdog bark.

Fix this issue with the lock only for the required critical section.

Change-Id: Ie20f7e54685ac31cbddaa78f3e00e207f9e9c853
Signed-off-by: default avatarSarthak Garg <sartgarg@codeaurora.org>
parent 8376a76a
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
	case MMC_ISSUE_DCMD:
		if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
			if (recovery_needed)
				__mmc_cqe_recovery_notifier(mq);
				mmc_cqe_recovery_notifier(mrq);
			return BLK_EH_RESET_TIMER;
		}
		/* No timeout (XXX: huh? comment doesn't make much sense) */
@@ -130,12 +130,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,

	spin_lock_irqsave(q->queue_lock, flags);

	if (mq->recovery_needed || !mq->use_cqe)
	if (mq->recovery_needed || !mq->use_cqe) {
		ret = BLK_EH_RESET_TIMER;
	else
		ret = mmc_cqe_timed_out(req);

		spin_unlock_irqrestore(q->queue_lock, flags);
	} else {
		spin_unlock_irqrestore(q->queue_lock, flags);
		ret = mmc_cqe_timed_out(req);
	}

	return ret;
}