On 4/16/23 13:09, Christoph Hellwig wrote:
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 69e9806f575455..231d3780e74ad1 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -188,7 +188,9 @@ static void blk_flush_complete_seq(struct request *rq,
case REQ_FSEQ_DATA:
list_move_tail(&rq->flush.list, &fq->flush_data_in_flight);
- blk_mq_add_to_requeue_list(rq, 0);
+ spin_lock(&q->requeue_lock);
+ list_add_tail(&rq->queuelist, &q->flush_list);
+ spin_unlock(&q->requeue_lock);
blk_mq_kick_requeue_list(q);
break;
At least the SCSI core can call blk_flush_complete_seq() from interrupt
context so I don't think the above code is correct. The call chain is as
follows:
LLD interrupt handler
scsi_done()
scsi_done_internal()
blk_mq_complete_request()
scsi_complete()
scsi_finish_command()
scsi_io_completion()
scsi_end_request()
__blk_mq_end_request()
flush_end_io()
blk_flush_complete_seq()
Bart.