Jianchao Wang 85bd6e61f3 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: bd166ef1 (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>
2019-01-30 08:53:54 -07:00
..
2018-12-09 17:45:40 -07:00
2019-01-02 18:49:58 -08:00
2018-11-07 13:42:32 -07:00
2018-11-30 14:48:04 -07:00
2018-12-17 11:19:54 -07:00
2018-12-16 19:53:47 -07:00
2018-12-28 14:48:06 -08:00
2018-11-15 12:13:25 -07:00
2018-12-28 14:48:06 -08:00
2018-12-28 13:19:59 -08:00
2018-12-21 08:47:58 -07:00
2018-11-16 08:34:06 -07:00
2018-10-25 11:17:40 -06:00
2018-05-31 10:50:54 -04:00
2018-12-29 13:03:29 -08:00
2018-11-07 13:42:32 -07:00