Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: host: Fix data stomping during mmc recovery
@ 2022-09-16  9:05 Wenchao Chen
  2022-09-20  9:32 ` Ulf Hansson
  0 siblings, 1 reply; 5+ messages in thread
From: Wenchao Chen @ 2022-09-16  9:05 UTC (permalink / raw)
  To: ulf.hansson
  Cc: baolin.wang, zhang.lyra, linux-mmc, linux-kernel, megoo.tang,
	lzx.stg

From: Wenchao Chen <wenchao.chen@unisoc.com>

The block device uses multiple queues to access emmc. There will be up to 3
requests in the hsq of the host. The current code will check whether there
is a request doing recovery before entering the queue, but it will not check
whether there is a request when the lock is issued. The request is in recovery
mode. If there is a request in recovery, then a read and write request is
initiated at this time, and the conflict between the request and the recovery
request will cause the data to be trampled.

Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
---
 drivers/mmc/host/mmc_hsq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mmc_hsq.c b/drivers/mmc/host/mmc_hsq.c
index a5e05ed0fda3..9d35453e7371 100644
--- a/drivers/mmc/host/mmc_hsq.c
+++ b/drivers/mmc/host/mmc_hsq.c
@@ -34,7 +34,7 @@ static void mmc_hsq_pump_requests(struct mmc_hsq *hsq)
 	spin_lock_irqsave(&hsq->lock, flags);
 
 	/* Make sure we are not already running a request now */
-	if (hsq->mrq) {
+	if (hsq->mrq || hsq->recovery_halt) {
 		spin_unlock_irqrestore(&hsq->lock, flags);
 		return;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-27 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-16  9:05 [PATCH] mmc: host: Fix data stomping during mmc recovery Wenchao Chen
2022-09-20  9:32 ` Ulf Hansson
2022-09-20 10:19   ` Adrian Hunter
2022-09-27  5:45     ` 陈文超
2022-09-27 12:13       ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox