RAID1: deadlock between freeze_array and blk plug?

From
Alexander Lyakas <hidden>
Date
2016-06-13 11:02:38
Hello Neil, Jes,

I wonder if the following deadlock is possible:

- Caller calls blk_start_plug and wants to submit two WRITE bios

- First bio successfully calls wait_barrier() and is appended to
plug->pending list

- Now somebody does freeze_array()

- freeze_array() unconditionally sets:
   conf->array_frozen = 1;
   and starts waiting for conf->nr_pending to go down

- Second WRITE bio calls wait_barrier, but it will wait for
"!conf->array_frozen" until it can proceed

- Now we have a deadlock: first bio will not be submitted because it
sits on the plug list of the caller, and caller is stuck in
wait_barrier, so it cannot do blk_finish_plug.

I am about to try to reproduce it on kernel 3.18, but looking at the
latest Linus tree, I don't see something preventing this from
happening either. Am I missing something?

Thanks,
Alex.
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