[AGK - This patch reverses the mempool workaround described below.]


Implement private fallback if immediate allocation from mempool fails.
Standard mempool_alloc() fallback can yield a deadlock when only the
calling process is able to refill the pool. In out-of-memory situations,
instead of waiting for itself, kmirrord now waits for someone else to
free some space, using a standard blocking allocation.

Signed-off-by: Daniel Kobras <kobras@linux.de>
Index: linux-2.6.18-rc7/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.18-rc7.orig/drivers/md/dm-raid1.c	2006-10-13 17:10:18.000000000 +0100
+++ linux-2.6.18-rc7/drivers/md/dm-raid1.c	2006-10-13 17:10:20.000000000 +0100
@@ -255,9 +255,7 @@ static struct region *__rh_alloc(struct 
 	struct region *reg, *nreg;
 
 	read_unlock(&rh->hash_lock);
-	nreg = mempool_alloc(rh->region_pool, GFP_ATOMIC);
-	if (unlikely(!nreg))
-		nreg = kmalloc(sizeof(struct region), GFP_NOIO);
+	nreg = mempool_alloc(rh->region_pool, GFP_NOIO);
 	nreg->state = rh->log->type->in_sync(rh->log, region, 1) ?
 		RH_CLEAN : RH_NOSYNC;
 	nreg->rh = rh;