Commit 455597a5 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

dlm: switch to GFP_ATOMIC in dlm allocations

Replace GFP_NOFS with GFP_ATOMIC.  Also stop using idr_preload which
uses a non-bh spin_lock.  This is further preparation for softirq
message processing.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 98808644
...@@ -1206,13 +1206,11 @@ static int _create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret, ...@@ -1206,13 +1206,11 @@ static int _create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret,
INIT_LIST_HEAD(&lkb->lkb_ownqueue); INIT_LIST_HEAD(&lkb->lkb_ownqueue);
INIT_LIST_HEAD(&lkb->lkb_rsb_lookup); INIT_LIST_HEAD(&lkb->lkb_rsb_lookup);
idr_preload(GFP_NOFS);
spin_lock(&ls->ls_lkbidr_spin); spin_lock(&ls->ls_lkbidr_spin);
rv = idr_alloc(&ls->ls_lkbidr, lkb, start, end, GFP_NOWAIT); rv = idr_alloc(&ls->ls_lkbidr, lkb, start, end, GFP_NOWAIT);
if (rv >= 0) if (rv >= 0)
lkb->lkb_id = rv; lkb->lkb_id = rv;
spin_unlock(&ls->ls_lkbidr_spin); spin_unlock(&ls->ls_lkbidr_spin);
idr_preload_end();
if (rv < 0) { if (rv < 0) {
log_error(ls, "create_lkb idr error %d", rv); log_error(ls, "create_lkb idr error %d", rv);
......
...@@ -84,7 +84,7 @@ char *dlm_allocate_lvb(struct dlm_ls *ls) ...@@ -84,7 +84,7 @@ char *dlm_allocate_lvb(struct dlm_ls *ls)
{ {
char *p; char *p;
p = kzalloc(ls->ls_lvblen, GFP_NOFS); p = kzalloc(ls->ls_lvblen, GFP_ATOMIC);
return p; return p;
} }
...@@ -97,7 +97,7 @@ struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls) ...@@ -97,7 +97,7 @@ struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls)
{ {
struct dlm_rsb *r; struct dlm_rsb *r;
r = kmem_cache_zalloc(rsb_cache, GFP_NOFS); r = kmem_cache_zalloc(rsb_cache, GFP_ATOMIC);
return r; return r;
} }
...@@ -112,7 +112,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls) ...@@ -112,7 +112,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls)
{ {
struct dlm_lkb *lkb; struct dlm_lkb *lkb;
lkb = kmem_cache_zalloc(lkb_cache, GFP_NOFS); lkb = kmem_cache_zalloc(lkb_cache, GFP_ATOMIC);
return lkb; return lkb;
} }
......
...@@ -310,7 +310,6 @@ static int recover_idr_add(struct dlm_rsb *r) ...@@ -310,7 +310,6 @@ static int recover_idr_add(struct dlm_rsb *r)
struct dlm_ls *ls = r->res_ls; struct dlm_ls *ls = r->res_ls;
int rv; int rv;
idr_preload(GFP_NOFS);
spin_lock(&ls->ls_recover_idr_lock); spin_lock(&ls->ls_recover_idr_lock);
if (r->res_id) { if (r->res_id) {
rv = -1; rv = -1;
...@@ -326,7 +325,6 @@ static int recover_idr_add(struct dlm_rsb *r) ...@@ -326,7 +325,6 @@ static int recover_idr_add(struct dlm_rsb *r)
rv = 0; rv = 0;
out_unlock: out_unlock:
spin_unlock(&ls->ls_recover_idr_lock); spin_unlock(&ls->ls_recover_idr_lock);
idr_preload_end();
return rv; return rv;
} }
......
...@@ -37,7 +37,7 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, ...@@ -37,7 +37,7 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid,
int length = le16_to_cpu(ms->m_header.h_length) - int length = le16_to_cpu(ms->m_header.h_length) -
sizeof(struct dlm_message); sizeof(struct dlm_message);
e = kmalloc(sizeof(struct rq_entry) + length, GFP_NOFS); e = kmalloc(sizeof(struct rq_entry) + length, GFP_ATOMIC);
if (!e) { if (!e) {
log_print("dlm_add_requestqueue: out of memory len %d", length); log_print("dlm_add_requestqueue: out of memory len %d", length);
return; return;
......
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