iomap: writeback ioend/bio allocation deadlock risk

From
Ming Lei <hidden>
Date
2021-05-21 03:28:18
Also in
linux-fsdevel
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
Thread (12 messages) 12 messages, 3 authors, last reply 2021-05-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help