linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RAID1: deadlock between freeze_array and blk plug?
@ 2016-06-13 11:02 Alexander Lyakas
       [not found] ` <CY1PR0801MB2252D339C65DF97375E3949C98560@CY1PR0801MB2252.namprd08.prod.outlook.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Lyakas @ 2016-06-13 11:02 UTC (permalink / raw)
  To: Neil Brown, Jes Sorensen, linux-raid

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-16 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 11:02 RAID1: deadlock between freeze_array and blk plug? Alexander Lyakas
     [not found] ` <CY1PR0801MB2252D339C65DF97375E3949C98560@CY1PR0801MB2252.namprd08.prod.outlook.com>
2016-06-16  7:48   ` Alexander Lyakas
2016-06-16 15:01     ` Alexander Lyakas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).