diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-01-13 19:13:36 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-01-14 11:18:16 -0500 |
commit | 119bc547362e5252074f81f56b8fcdac45cedff4 (patch) | |
tree | 57f4c605fc2e70993cadc426fd9f6cf5c4c9c1de | |
parent | 6a388618f120cdc70cd6b6dbcab5f7a4aff500f6 (diff) |
dm snapshot: use GFP_KERNEL when initializing exceptions
The list of initial exceptions is loaded in the target constructor. We
are allowed to allocate memory with GFP_KERNEL at this point. So,
change alloc_completed_exception to use GFP_KERNEL when being called
from the constructor.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-snap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 944690bafd93..717718558bd9 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -610,12 +610,12 @@ static struct dm_exception *dm_lookup_exception(struct dm_exception_table *et, | |||
610 | return NULL; | 610 | return NULL; |
611 | } | 611 | } |
612 | 612 | ||
613 | static struct dm_exception *alloc_completed_exception(void) | 613 | static struct dm_exception *alloc_completed_exception(gfp_t gfp) |
614 | { | 614 | { |
615 | struct dm_exception *e; | 615 | struct dm_exception *e; |
616 | 616 | ||
617 | e = kmem_cache_alloc(exception_cache, GFP_NOIO); | 617 | e = kmem_cache_alloc(exception_cache, gfp); |
618 | if (!e) | 618 | if (!e && gfp == GFP_NOIO) |
619 | e = kmem_cache_alloc(exception_cache, GFP_ATOMIC); | 619 | e = kmem_cache_alloc(exception_cache, GFP_ATOMIC); |
620 | 620 | ||
621 | return e; | 621 | return e; |
@@ -697,7 +697,7 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new) | |||
697 | struct dm_snapshot *s = context; | 697 | struct dm_snapshot *s = context; |
698 | struct dm_exception *e; | 698 | struct dm_exception *e; |
699 | 699 | ||
700 | e = alloc_completed_exception(); | 700 | e = alloc_completed_exception(GFP_KERNEL); |
701 | if (!e) | 701 | if (!e) |
702 | return -ENOMEM; | 702 | return -ENOMEM; |
703 | 703 | ||
@@ -1405,7 +1405,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success) | |||
1405 | goto out; | 1405 | goto out; |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | e = alloc_completed_exception(); | 1408 | e = alloc_completed_exception(GFP_NOIO); |
1409 | if (!e) { | 1409 | if (!e) { |
1410 | down_write(&s->lock); | 1410 | down_write(&s->lock); |
1411 | __invalidate_snapshot(s, -ENOMEM); | 1411 | __invalidate_snapshot(s, -ENOMEM); |