Hello Guys, I found there may be two deadlock risk under memory pressure wrt. ioend/bio allocation in iomap writeback code wrt. bio_alloc_bioset(): if %__gfp_direct_reclaim is set then bio_alloc will always be able to allocate a bio. this is due to the mempool guarantees. to make this work, callers must never allocate more than 1 bio at a time from the general pool. callers that need to allocate more than 1 bio must always submit the previously allocated bio for io before attempting to allocate a new one. failure to do so can cause deadlocks under memory pressure. 1) more than one ioends can be allocated from 'iomap_ioend_bioset' before submitting them all, so mempoll guarantee can't be made, which can be observed frequently in writeback over ext4 2) more than one chained bio(allocated from fs_bio_set) via iomap_chain_bio, which is easy observed when writing big files on XFS: - the old bio is submitted _after_ the new allocation - submission on old chained bio can't make forward progress because all chained bios can only be freed after the whole ioend is completed, see iomap_finish_ioend() Both looks not hard to fix, just want to make sure they are real issues? Thanks, Ming