1 From 748285ccf7ea76d3d76d0d5f2945ad6fb91f5329 Mon Sep 17 00:00:00 2001
2 From: David Teigland <teigland@redhat.com>
3 Date: Fri, 15 May 2009 10:50:57 -0500
4 Subject: [PATCH] dlm: use more NOFS allocation
6 Change some GFP_KERNEL allocations to use either GFP_NOFS or
7 ls_allocation (when available) which the fs sets to GFP_NOFS.
8 The point is to prevent allocations from going back into the
9 cluster fs in places where that might lead to deadlock.
11 Signed-off-by: David Teigland <teigland@redhat.com>
12 Signed-off-by: Coly Li <coly.li@suse.de>
14 fs/dlm/dir.c | 7 ++++---
15 fs/dlm/lowcomms.c | 6 +++---
16 fs/dlm/member.c | 8 ++++----
17 fs/dlm/requestqueue.c | 2 +-
18 4 files changed, 12 insertions(+), 11 deletions(-)
20 diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c
21 index 858fba1..c4dfa1d 100644
24 @@ -49,7 +49,8 @@ static struct dlm_direntry *get_free_de(struct dlm_ls *ls, int len)
25 spin_unlock(&ls->ls_recover_list_lock);
28 - de = kzalloc(sizeof(struct dlm_direntry) + len, GFP_KERNEL);
29 + de = kzalloc(sizeof(struct dlm_direntry) + len,
34 @@ -211,7 +212,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
38 - last_name = kmalloc(DLM_RESNAME_MAXLEN, GFP_KERNEL);
39 + last_name = kmalloc(DLM_RESNAME_MAXLEN, ls->ls_allocation);
43 @@ -322,7 +323,7 @@ static int get_entry(struct dlm_ls *ls, int nodeid, char *name,
44 if (namelen > DLM_RESNAME_MAXLEN)
47 - de = kzalloc(sizeof(struct dlm_direntry) + namelen, GFP_KERNEL);
48 + de = kzalloc(sizeof(struct dlm_direntry) + namelen, ls->ls_allocation);
52 diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
53 index 2559a97..cdb580a 100644
54 --- a/fs/dlm/lowcomms.c
55 +++ b/fs/dlm/lowcomms.c
56 @@ -500,7 +500,7 @@ static void process_sctp_notification(struct connection *con,
60 - new_con = nodeid2con(nodeid, GFP_KERNEL);
61 + new_con = nodeid2con(nodeid, GFP_NOFS);
65 @@ -736,7 +736,7 @@ static int tcp_accept_from_sock(struct connection *con)
66 * the same time and the connections cross on the wire.
67 * In this case we store the incoming one in "othercon"
69 - newcon = nodeid2con(nodeid, GFP_KERNEL);
70 + newcon = nodeid2con(nodeid, GFP_NOFS);
74 @@ -746,7 +746,7 @@ static int tcp_accept_from_sock(struct connection *con)
75 struct connection *othercon = newcon->othercon;
78 - othercon = kmem_cache_zalloc(con_cache, GFP_KERNEL);
79 + othercon = kmem_cache_zalloc(con_cache, GFP_NOFS);
81 log_print("failed to allocate incoming socket");
82 mutex_unlock(&newcon->sock_mutex);
83 diff --git a/fs/dlm/member.c b/fs/dlm/member.c
84 index 2afb770..b128775 100644
87 @@ -48,7 +48,7 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid)
88 struct dlm_member *memb;
91 - memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL);
92 + memb = kzalloc(sizeof(struct dlm_member), ls->ls_allocation);
96 @@ -143,7 +143,7 @@ static void make_member_array(struct dlm_ls *ls)
98 ls->ls_total_weight = total;
100 - array = kmalloc(sizeof(int) * total, GFP_KERNEL);
101 + array = kmalloc(sizeof(int) * total, ls->ls_allocation);
105 @@ -226,7 +226,7 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)
107 log_debug(ls, "new nodeid %d is a re-added member", rv->new[i]);
109 - memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL);
110 + memb = kzalloc(sizeof(struct dlm_member), ls->ls_allocation);
113 memb->nodeid = rv->new[i];
114 @@ -341,7 +341,7 @@ int dlm_ls_start(struct dlm_ls *ls)
115 int *ids = NULL, *new = NULL;
116 int error, ids_count = 0, new_count = 0;
118 - rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL);
119 + rv = kzalloc(sizeof(struct dlm_recover), ls->ls_allocation);
123 diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
124 index daa4183..7a2307c 100644
125 --- a/fs/dlm/requestqueue.c
126 +++ b/fs/dlm/requestqueue.c
127 @@ -35,7 +35,7 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms)
129 int length = ms->m_header.h_length - sizeof(struct dlm_message);
131 - e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL);
132 + e = kmalloc(sizeof(struct rq_entry) + length, ls->ls_allocation);
134 log_print("dlm_add_requestqueue: out of memory len %d", length);