]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
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 | |
5 | ||
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. | |
10 | ||
11 | Signed-off-by: David Teigland <teigland@redhat.com> | |
12 | Signed-off-by: Coly Li <coly.li@suse.de> | |
13 | --- | |
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(-) | |
19 | ||
20 | diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c | |
21 | index 858fba1..c4dfa1d 100644 | |
22 | --- a/fs/dlm/dir.c | |
23 | +++ b/fs/dlm/dir.c | |
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); | |
26 | ||
27 | if (!found) | |
28 | - de = kzalloc(sizeof(struct dlm_direntry) + len, GFP_KERNEL); | |
29 | + de = kzalloc(sizeof(struct dlm_direntry) + len, | |
30 | + ls->ls_allocation); | |
31 | return de; | |
32 | } | |
33 | ||
34 | @@ -211,7 +212,7 @@ int dlm_recover_directory(struct dlm_ls *ls) | |
35 | ||
36 | dlm_dir_clear(ls); | |
37 | ||
38 | - last_name = kmalloc(DLM_RESNAME_MAXLEN, GFP_KERNEL); | |
39 | + last_name = kmalloc(DLM_RESNAME_MAXLEN, ls->ls_allocation); | |
40 | if (!last_name) | |
41 | goto out; | |
42 | ||
43 | @@ -322,7 +323,7 @@ static int get_entry(struct dlm_ls *ls, int nodeid, char *name, | |
44 | if (namelen > DLM_RESNAME_MAXLEN) | |
45 | return -EINVAL; | |
46 | ||
47 | - de = kzalloc(sizeof(struct dlm_direntry) + namelen, GFP_KERNEL); | |
48 | + de = kzalloc(sizeof(struct dlm_direntry) + namelen, ls->ls_allocation); | |
49 | if (!de) | |
50 | return -ENOMEM; | |
51 | ||
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, | |
57 | return; | |
58 | } | |
59 | ||
60 | - new_con = nodeid2con(nodeid, GFP_KERNEL); | |
61 | + new_con = nodeid2con(nodeid, GFP_NOFS); | |
62 | if (!new_con) | |
63 | return; | |
64 | ||
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" | |
68 | */ | |
69 | - newcon = nodeid2con(nodeid, GFP_KERNEL); | |
70 | + newcon = nodeid2con(nodeid, GFP_NOFS); | |
71 | if (!newcon) { | |
72 | result = -ENOMEM; | |
73 | goto accept_err; | |
74 | @@ -746,7 +746,7 @@ static int tcp_accept_from_sock(struct connection *con) | |
75 | struct connection *othercon = newcon->othercon; | |
76 | ||
77 | if (!othercon) { | |
78 | - othercon = kmem_cache_zalloc(con_cache, GFP_KERNEL); | |
79 | + othercon = kmem_cache_zalloc(con_cache, GFP_NOFS); | |
80 | if (!othercon) { | |
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 | |
85 | --- a/fs/dlm/member.c | |
86 | +++ b/fs/dlm/member.c | |
87 | @@ -48,7 +48,7 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid) | |
88 | struct dlm_member *memb; | |
89 | int w, error; | |
90 | ||
91 | - memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL); | |
92 | + memb = kzalloc(sizeof(struct dlm_member), ls->ls_allocation); | |
93 | if (!memb) | |
94 | return -ENOMEM; | |
95 | ||
96 | @@ -143,7 +143,7 @@ static void make_member_array(struct dlm_ls *ls) | |
97 | ||
98 | ls->ls_total_weight = total; | |
99 | ||
100 | - array = kmalloc(sizeof(int) * total, GFP_KERNEL); | |
101 | + array = kmalloc(sizeof(int) * total, ls->ls_allocation); | |
102 | if (!array) | |
103 | return; | |
104 | ||
105 | @@ -226,7 +226,7 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out) | |
106 | continue; | |
107 | log_debug(ls, "new nodeid %d is a re-added member", rv->new[i]); | |
108 | ||
109 | - memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL); | |
110 | + memb = kzalloc(sizeof(struct dlm_member), ls->ls_allocation); | |
111 | if (!memb) | |
112 | return -ENOMEM; | |
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; | |
117 | ||
118 | - rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL); | |
119 | + rv = kzalloc(sizeof(struct dlm_recover), ls->ls_allocation); | |
120 | if (!rv) | |
121 | return -ENOMEM; | |
122 | ||
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) | |
128 | struct rq_entry *e; | |
129 | int length = ms->m_header.h_length - sizeof(struct dlm_message); | |
130 | ||
131 | - e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL); | |
132 | + e = kmalloc(sizeof(struct rq_entry) + length, ls->ls_allocation); | |
133 | if (!e) { | |
134 | log_print("dlm_add_requestqueue: out of memory len %d", length); | |
135 | return; | |
136 | -- | |
137 | 1.6.0.2 | |
138 |