On Fri, 2018-11-30 at 09:56 -0700, Jens Axboe wrote: +AD4 We can't wait for polled events to complete, as they may require active +AD4 polling from whoever submitted it. If that is the same task that is +AD4 submitting new IO, we could deadlock waiting for IO to complete that +AD4 this task is supposed to be completing itself. +AD4 +AD4 Signed-off-by: Jens Axboe +ADw-axboe+AEA-kernel.dk+AD4 +AD4 --- +AD4 fs/block+AF8-dev.c +AHw 10 +-+-+-+-+-+-+-+-+-- +AD4 1 file changed, 9 insertions(+-), 1 deletion(-) +AD4 +AD4 diff --git a/fs/block+AF8-dev.c b/fs/block+AF8-dev.c +AD4 index 6de8d35f6e41..ebc3d5a0f424 100644 +AD4 --- a/fs/block+AF8-dev.c +AD4 +-+-+- b/fs/block+AF8-dev.c +AD4 +AEAAQA -402,8 +-402,16 +AEAAQA +AF8AXw-blkdev+AF8-direct+AF8-IO(struct kiocb +ACo-iocb, struct iov+AF8-iter +ACo-iter, int nr+AF8-pages) +AD4 +AD4 nr+AF8-pages +AD0 iov+AF8-iter+AF8-npages(iter, BIO+AF8-MAX+AF8-PAGES)+ADs +AD4 if (+ACE-nr+AF8-pages) +AHs +AD4 - if (iocb-+AD4-ki+AF8-flags +ACY IOCB+AF8-HIPRI) +AD4 +- if (iocb-+AD4-ki+AF8-flags +ACY IOCB+AF8-HIPRI) +AHs +AD4 bio-+AD4-bi+AF8-opf +AHwAPQ REQ+AF8-HIPRI+ADs +AD4 +- /+ACo +AD4 +- +ACo For async polled IO, we can't wait for +AD4 +- +ACo requests to complete, as they may also be +AD4 +- +ACo polled and require active reaping. +AD4 +- +ACo-/ +AD4 +- if (+ACE-is+AF8-sync) +AD4 +- bio-+AD4-bi+AF8-opf +AHwAPQ REQ+AF8-NOWAIT+ADs +AD4 +- +AH0 +AD4 +AD4 qc +AD0 submit+AF8-bio(bio)+ADs +AD4 WRITE+AF8-ONCE(iocb-+AD4-ki+AF8-cookie, qc)+ADs Setting REQ+AF8-NOWAIT from inside the block layer will make the code that submits requests harder to review. Have you considered to make this code fail I/O if REQ+AF8-NOWAIT has not been set and to require that the context that submits I/O sets REQ+AF8-NOWAIT? Thanks, Bart.