]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix potential IO hang when turning off io_poll
authorJeffle Xu <jefflexu@linux.alibaba.com>
Mon, 22 Feb 2021 06:54:52 +0000 (14:54 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 22 Feb 2021 13:40:02 +0000 (06:40 -0700)
commit40324aafbc7ca932b51da74f983249221103a5fb
tree7b69248f21d2b2c7db0e8b6f9e8131d8c45515ed
parentc01b495bac0a26049c8fc4c67c51c8cf866b8cd7
block: fix potential IO hang when turning off io_poll

QUEUE_FLAG_POLL flag will be cleared when turning off 'io_poll', while
at that moment there may be IOs stuck in hw queue uncompleted. The
following polling routine won't help reap these IOs, since blk_poll()
will return immediately because of cleared QUEUE_FLAG_POLL flag. Thus
these IOs will hang until they finnaly time out. The hang out can be
observed by 'fio --engine=io_uring iodepth=1', while turning off
'io_poll' at the same time.

To fix this, freeze and flush the request queue first when turning off
'io_poll'.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c