Skip to content

Commit f016a54

Browse files
committed
Merge tag 'block-5.9-2020-10-02' of git://git.kernel.dk/linux-block
Pull block fix from Jens Axboe: "Single fix for a ->commit_rqs failure case" * tag 'block-5.9-2020-10-02' of git://git.kernel.dk/linux-block: blk-mq: call commit_rqs while list empty but error happen
2 parents d4fce2e + 632bfb6 commit f016a54

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

block/blk-mq.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,11 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
14121412

14131413
hctx->dispatched[queued_to_index(queued)]++;
14141414

1415+
/* If we didn't flush the entire list, we could have told the driver
1416+
* there was more coming, but that turned out to be a lie.
1417+
*/
1418+
if ((!list_empty(list) || errors) && q->mq_ops->commit_rqs && queued)
1419+
q->mq_ops->commit_rqs(hctx);
14151420
/*
14161421
* Any items that need requeuing? Stuff them into hctx->dispatch,
14171422
* that is where we will continue on next queue run.
@@ -1425,14 +1430,6 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
14251430

14261431
blk_mq_release_budgets(q, nr_budgets);
14271432

1428-
/*
1429-
* If we didn't flush the entire list, we could have told
1430-
* the driver there was more coming, but that turned out to
1431-
* be a lie.
1432-
*/
1433-
if (q->mq_ops->commit_rqs && queued)
1434-
q->mq_ops->commit_rqs(hctx);
1435-
14361433
spin_lock(&hctx->lock);
14371434
list_splice_tail_init(list, &hctx->dispatch);
14381435
spin_unlock(&hctx->lock);
@@ -2079,6 +2076,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
20792076
struct list_head *list)
20802077
{
20812078
int queued = 0;
2079+
int errors = 0;
20822080

20832081
while (!list_empty(list)) {
20842082
blk_status_t ret;
@@ -2095,6 +2093,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
20952093
break;
20962094
}
20972095
blk_mq_end_request(rq, ret);
2096+
errors++;
20982097
} else
20992098
queued++;
21002099
}
@@ -2104,7 +2103,8 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
21042103
* the driver there was more coming, but that turned out to
21052104
* be a lie.
21062105
*/
2107-
if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs && queued)
2106+
if ((!list_empty(list) || errors) &&
2107+
hctx->queue->mq_ops->commit_rqs && queued)
21082108
hctx->queue->mq_ops->commit_rqs(hctx);
21092109
}
21102110

0 commit comments

Comments
 (0)