• Jianchao Wang's avatar
    blk-mq: fix a hung issue when fsync · 883d561c
    Jianchao Wang authored
    [ Upstream commit 85bd6e61f34dffa8ec2dc75ff3c02ee7b2f1cbce ]
    
    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: 's avatarFlorian Stecker <m19@florianstecker.de>
    Tested-by: 's avatarFlorian Stecker <m19@florianstecker.de>
    Signed-off-by: 's avatarJianchao Wang <jianchao.w.wang@oracle.com>
    Signed-off-by: 's avatarJens Axboe <axboe@kernel.dk>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    883d561c
Name
Last commit
Last update
..
partitions Loading commit data...
Kconfig Loading commit data...
Kconfig.iosched Loading commit data...
Makefile Loading commit data...
badblocks.c Loading commit data...
bfq-cgroup.c Loading commit data...
bfq-iosched.c Loading commit data...
bfq-iosched.h Loading commit data...
bfq-wf2q.c Loading commit data...
bio-integrity.c Loading commit data...
bio.c Loading commit data...
blk-cgroup.c Loading commit data...
blk-core.c Loading commit data...
blk-exec.c Loading commit data...
blk-flush.c Loading commit data...
blk-integrity.c Loading commit data...
blk-ioc.c Loading commit data...
blk-lib.c Loading commit data...
blk-map.c Loading commit data...
blk-merge.c Loading commit data...
blk-mq-cpumap.c Loading commit data...
blk-mq-debugfs.c Loading commit data...
blk-mq-debugfs.h Loading commit data...
blk-mq-pci.c Loading commit data...
blk-mq-rdma.c Loading commit data...
blk-mq-sched.c Loading commit data...
blk-mq-sched.h Loading commit data...
blk-mq-sysfs.c Loading commit data...
blk-mq-tag.c Loading commit data...
blk-mq-tag.h Loading commit data...
blk-mq-virtio.c Loading commit data...
blk-mq.c Loading commit data...
blk-mq.h Loading commit data...
blk-settings.c Loading commit data...
blk-softirq.c Loading commit data...
blk-stat.c Loading commit data...
blk-stat.h Loading commit data...
blk-sysfs.c Loading commit data...
blk-tag.c Loading commit data...
blk-throttle.c Loading commit data...
blk-timeout.c Loading commit data...
blk-wbt.c Loading commit data...
blk-wbt.h Loading commit data...
blk-zoned.c Loading commit data...
blk.h Loading commit data...
bounce.c Loading commit data...
bsg-lib.c Loading commit data...
bsg.c Loading commit data...
cfq-iosched.c Loading commit data...
cmdline-parser.c Loading commit data...
compat_ioctl.c Loading commit data...
deadline-iosched.c Loading commit data...
elevator.c Loading commit data...
genhd.c Loading commit data...
ioctl.c Loading commit data...
ioprio.c Loading commit data...
kyber-iosched.c Loading commit data...
mq-deadline.c Loading commit data...
noop-iosched.c Loading commit data...
opal_proto.h Loading commit data...
partition-generic.c Loading commit data...
scsi_ioctl.c Loading commit data...
sed-opal.c Loading commit data...
t10-pi.c Loading commit data...