Commit 119bc547 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer

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: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 6a388618
...@@ -610,12 +610,12 @@ static struct dm_exception *dm_lookup_exception(struct dm_exception_table *et, ...@@ -610,12 +610,12 @@ static struct dm_exception *dm_lookup_exception(struct dm_exception_table *et,
return NULL; return NULL;
} }
static struct dm_exception *alloc_completed_exception(void) static struct dm_exception *alloc_completed_exception(gfp_t gfp)
{ {
struct dm_exception *e; struct dm_exception *e;
e = kmem_cache_alloc(exception_cache, GFP_NOIO); e = kmem_cache_alloc(exception_cache, gfp);
if (!e) if (!e && gfp == GFP_NOIO)
e = kmem_cache_alloc(exception_cache, GFP_ATOMIC); e = kmem_cache_alloc(exception_cache, GFP_ATOMIC);
return e; return e;
...@@ -697,7 +697,7 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new) ...@@ -697,7 +697,7 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new)
struct dm_snapshot *s = context; struct dm_snapshot *s = context;
struct dm_exception *e; struct dm_exception *e;
e = alloc_completed_exception(); e = alloc_completed_exception(GFP_KERNEL);
if (!e) if (!e)
return -ENOMEM; return -ENOMEM;
...@@ -1405,7 +1405,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success) ...@@ -1405,7 +1405,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success)
goto out; goto out;
} }
e = alloc_completed_exception(); e = alloc_completed_exception(GFP_NOIO);
if (!e) { if (!e) {
down_write(&s->lock); down_write(&s->lock);
__invalidate_snapshot(s, -ENOMEM); __invalidate_snapshot(s, -ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment