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

Commit 0bc5eaae authored by Sujit Reddy Thumma's avatar Sujit Reddy Thumma
Browse files

mmc: core: fix block request queue hang during data crc errors



When data CRC errors occur during write transactions, mmc
block layer queries the card for successful writes. If the card
reports bytes requested as bytes successfully written, the mmc
block layer will end the request with blk_end_request(). If there
is a following async request pending for execution, the request
is thrown away while handling CRC errors leading to hang in
request queue. The hang is visible when user issues a sync()
system call.

The sequence of events are as follows -

mmcqd -> fetch a request -> send it to host driver -> fetch another
request -> wait for previous request to complete -> previous request
is in error -> skip sending current request to host driver and
do error handling for previous request in error.

During the last step, after error handling is completed the mmc
block layer does not requeue the current request which is skipped
and hence the request is infinitely stuck in the driver.

Change-Id: I9528fbe3ccb5b723fcd0793f86cca43906c4c29c
Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
parent 6ddb099c
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -2636,8 +2636,20 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
			break;
		case MMC_BLK_CMD_ERR:
			ret = mmc_blk_cmd_err(md, card, brq, req, ret);
			if (!mmc_blk_reset(md, card->host, type))
			if (!mmc_blk_reset(md, card->host, type)) {
				if (!ret) {
					/*
					 * We have successfully completed block
					 * request and notified to upper layers.
					 * As the reset is successful, assume
					 * h/w is in clean state and proceed
					 * with new request.
					 */
					BUG_ON(card->host->areq);
					goto start_new_req;
				}
				break;
			}
			goto cmd_abort;
		case MMC_BLK_RETRY:
			if (retry++ < 5)