Skip to content

Commit 85bd6e6

Browse files
Jianchao Wangaxboe
authored andcommitted
blk-mq: fix a hung issue when fsync
Florian reported a io hung issue when fsync(). It should be triggered by following race condition. data + post flush a flush blk_flush_complete_seq case REQ_FSEQ_DATA blk_flush_queue_rq issued to driver blk_mq_dispatch_rq_list try to issue a flush req failed due to NON-NCQ command .queue_rq return BLK_STS_DEV_RESOURCE request completion req->end_io // doesn't check RESTART mq_flush_data_end_io case REQ_FSEQ_POSTFLUSH blk_kick_flush do nothing because previous flush has not been completed blk_mq_run_hw_queue insert rq to hctx->dispatch due to RESTART is still set, do nothing To fix this, replace the blk_mq_run_hw_queue in mq_flush_data_end_io with blk_mq_sched_restart to check and clear the RESTART flag. Fixes: bd166ef (blk-mq-sched: add framework for MQ capable IO schedulers) Reported-by: Florian Stecker <m19@florianstecker.de> Tested-by: Florian Stecker <m19@florianstecker.de> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2e3c18d commit 85bd6e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/blk-flush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error)
335335
blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error);
336336
spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
337337

338-
blk_mq_run_hw_queue(hctx, true);
338+
blk_mq_sched_restart(hctx);
339339
}
340340

341341
/**

0 commit comments

Comments
 (0)