[dm-devel] Re: [PATCH] raid1: use __GFP_NOFAIL

Alasdair G Kergon agk at redhat.com
Thu Apr 30 23:14:43 UTC 2009


On Mon, Apr 27, 2009 at 07:01:22AM -0400, Mikulas Patocka wrote:
> This is a bug I found when implementing the barriers. There should be 
> __GFP_NOFAIL if the code can't handle an allocation failure.
 
See also this one:
  dm-raid1-mempool-bug-workaround-reversion.patch

Has the original reason for that workaround gone away now or is that
mempool still being used incorrectly?

Alasdair


From: Alasdair G Kergon <agk at redhat.com>

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 at linux.de>
Signed-off-by: Alasdair G Kergon <agk at redhat.com>
---
[AGK - This patch reverses the mempool workaround described above.]

 drivers/md/dm-raid1.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

Index: linux-2.6.19/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.19.orig/drivers/md/dm-raid1.c	2006-12-06 20:49:41.000000000 +0000
+++ linux-2.6.19/drivers/md/dm-raid1.c	2006-12-06 20:49:44.000000000 +0000
@@ -261,9 +261,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;




More information about the dm-devel mailing list