Message ID | 20240608143115.972486-1-chengming.zhou@linux.dev (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] block: fix request.queuelist usage in flush | expand |
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Sat, 08 Jun 2024 22:31:15 +0800, Chengming Zhou wrote: > Friedrich Weber reported a kernel crash problem and bisected to commit > 81ada09cc25e ("blk-flush: reuse rq queuelist in flush state machine"). > > The root cause is that we use "list_move_tail(&rq->queuelist, pending)" > in the PREFLUSH/POSTFLUSH sequences. But rq->queuelist.next == xxx since > it's popped out from plug->cached_rq in __blk_mq_alloc_requests_batch(). > We don't initialize its queuelist just for this first request, although > the queuelist of all later popped requests will be initialized. > > [...] Applied, thanks! [1/1] block: fix request.queuelist usage in flush commit: d0321c812d89c5910d8da8e4b10c891c6b96ff70 Best regards,
diff --git a/block/blk-flush.c b/block/blk-flush.c index c17cf8ed8113..cca4f9131f79 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -185,7 +185,7 @@ static void blk_flush_complete_seq(struct request *rq, /* queue for flush */ if (list_empty(pending)) fq->flush_pending_since = jiffies; - list_move_tail(&rq->queuelist, pending); + list_add_tail(&rq->queuelist, pending); break; case REQ_FSEQ_DATA: @@ -263,6 +263,7 @@ static enum rq_end_io_ret flush_end_io(struct request *flush_rq, unsigned int seq = blk_flush_cur_seq(rq); BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH); + list_del_init(&rq->queuelist); blk_flush_complete_seq(rq, fq, seq, error); }