]> git.baikalelectronics.ru Git - kernel.git/commit
md: Fix possible deadlock with multiple mempool allocations.
authorNeilBrown <neilb@suse.de>
Tue, 19 Oct 2010 01:54:01 +0000 (12:54 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 28 Oct 2010 06:34:07 +0000 (17:34 +1100)
commitb3ce5bdbca59fec633970ea2f5a236908601f51a
tree3a1abaa98ebcbd62eacfbe95d72e44195fb3bc1f
parent06c9ae2acc3bcfae0e2f7206b38699aafe67af13
md: Fix possible deadlock with multiple mempool allocations.

It is not safe to allocate from a mempool while holding an item
previously allocated from that mempool as that can deadlock when the
mempool is close to exhaustion.

So don't use a bio list to collect the bios to write to multiple
devices in raid1 and raid10.
Instead queue each bio as it becomes available so an unplug will
activate all previously allocated bios and so a new bio has a chance
of being allocated.

This means we must set the 'remaining' count to '1' before submitting
any requests, then when all are submitted, decrement 'remaining' and
possible handle the write completion at that point.

Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com>
Tested-by: Torsten Kaiser <just.for.lkml@googlemail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid1.c
drivers/md/raid10.c