Skip to content

Commit cb38449

Browse files
yibin123-unisocsmb49
authored andcommitted
mmc: block: Fix in_flight[issue_type] value error
BugLink: https://bugs.launchpad.net/bugs/2039110 commit 4b430d4 upstream. For a completed request, after the mmc_blk_mq_complete_rq(mq, req) function is executed, the bitmap_tags corresponding to the request will be cleared, that is, the request will be regarded as idle. If the request is acquired by a different type of process at this time, the issue_type of the request may change. It further caused the value of mq->in_flight[issue_type] to be abnormal, and a large number of requests could not be sent. p1: p2: mmc_blk_mq_complete_rq blk_mq_free_request blk_mq_get_request blk_mq_rq_ctx_init mmc_blk_mq_dec_in_flight mmc_issue_type(mq, req) This strategy can ensure the consistency of issue_type before and after executing mmc_blk_mq_complete_rq. Fixes: 8119697 ("mmc: block: Add blk-mq support") Cc: stable@vger.kernel.org Signed-off-by: Yibin Ding <yibin.ding@unisoc.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20230802023023.1318134-1-yunlong.xing@unisoc.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent f2f6904 commit cb38449

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/mmc/core/block.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,14 +2084,14 @@ static void mmc_blk_mq_poll_completion(struct mmc_queue *mq,
20842084
mmc_blk_urgent_bkops(mq, mqrq);
20852085
}
20862086

2087-
static void mmc_blk_mq_dec_in_flight(struct mmc_queue *mq, struct request *req)
2087+
static void mmc_blk_mq_dec_in_flight(struct mmc_queue *mq, enum mmc_issue_type issue_type)
20882088
{
20892089
unsigned long flags;
20902090
bool put_card;
20912091

20922092
spin_lock_irqsave(&mq->lock, flags);
20932093

2094-
mq->in_flight[mmc_issue_type(mq, req)] -= 1;
2094+
mq->in_flight[issue_type] -= 1;
20952095

20962096
put_card = (mmc_tot_in_flight(mq) == 0);
20972097

@@ -2104,6 +2104,7 @@ static void mmc_blk_mq_dec_in_flight(struct mmc_queue *mq, struct request *req)
21042104
static void mmc_blk_mq_post_req(struct mmc_queue *mq, struct request *req,
21052105
bool can_sleep)
21062106
{
2107+
enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
21072108
struct mmc_queue_req *mqrq = req_to_mmc_queue_req(req);
21082109
struct mmc_request *mrq = &mqrq->brq.mrq;
21092110
struct mmc_host *host = mq->card->host;
@@ -2123,7 +2124,7 @@ static void mmc_blk_mq_post_req(struct mmc_queue *mq, struct request *req,
21232124
blk_mq_complete_request(req);
21242125
}
21252126

2126-
mmc_blk_mq_dec_in_flight(mq, req);
2127+
mmc_blk_mq_dec_in_flight(mq, issue_type);
21272128
}
21282129

21292130
void mmc_blk_mq_recovery(struct mmc_queue *mq)

0 commit comments

Comments
 (0)