mmc: queue: fix race in mmc shutdown
The shutdown handler waits for in-flight requests only.
It stops the block queue, but doesn't issue the already
queued requests to the LLD. Furthermore, a request which
is in the process of being queued will timeout eventually
because CQE would be halted by shutdown handler.
mmc_cmdq_thread(mct) -> pulls request (r1)
shutdown invoked
stops block queue
halts cqe
(mct) -> issues r1 to LLD
- pulls already issued requests
- CQE halted -> requeues request
- issued request (r1) times out
Hence, in shutdown handler
- stop the block layer queue
- set a state indicating shutdown
- wake up mmc_cmdqd
- mmc_cmdqd:
- pull requests and issue to LLD
- complete the issuing of already queued requests
- wake up shutdown handler
- wait for completion from mmc_cmdqd
- wait for all issued request to complete
- proceed with shutdown
Change-Id: I30a9664d8ba2f4b4f580c2cf71c5d01b735c9491
Signed-off-by:
Asutosh Das <asutoshd@codeaurora.org>
Loading
Please register or sign in to comment