]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Steven Whitehouse <swhiteho@redhat.com> |
2 | commit d6d7b702a3a1ca50f7ca2bebaa79c80425156bac | |
3 | Author: Steven Whitehouse <swhiteho@redhat.com> | |
4 | Date: Wed Nov 12 16:49:48 2008 -0600 | |
5 | Subject: dlm: fix up memory allocation flags | |
6 | ||
7 | Use ls_allocation for memory allocations, which a cluster fs sets to | |
8 | GFP_NOFS. Use GFP_NOFS for allocations when no lockspace struct is | |
9 | available. Taking dlm locks needs to avoid calling back into the | |
10 | cluster fs because write-out can require taking dlm locks. | |
11 | ||
12 | Cc: Christine Caulfield <ccaulfie@redhat.com> | |
13 | Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> | |
14 | Signed-off-by: David Teigland <teigland@redhat.com> | |
15 | Signed-off-by: Coly Li <coly.li@suse.de> | |
16 | ||
17 | diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c | |
18 | index 3962262..1e72031 100644 | |
19 | --- a/fs/dlm/lowcomms.c | |
20 | +++ b/fs/dlm/lowcomms.c | |
21 | @@ -295,6 +295,7 @@ static int add_sock(struct socket *sock, struct connection *con) | |
22 | con->sock->sk->sk_write_space = lowcomms_write_space; | |
23 | con->sock->sk->sk_state_change = lowcomms_state_change; | |
24 | con->sock->sk->sk_user_data = con; | |
25 | + con->sock->sk->sk_allocation = GFP_NOFS; | |
26 | return 0; | |
27 | } | |
28 | ||
29 | diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c | |
30 | index 54c14c6..c1775b8 100644 | |
31 | --- a/fs/dlm/memory.c | |
32 | +++ b/fs/dlm/memory.c | |
33 | @@ -39,7 +39,7 @@ char *dlm_allocate_lvb(struct dlm_ls *ls) | |
34 | { | |
35 | char *p; | |
36 | ||
37 | - p = kzalloc(ls->ls_lvblen, GFP_KERNEL); | |
38 | + p = kzalloc(ls->ls_lvblen, ls->ls_allocation); | |
39 | return p; | |
40 | } | |
41 | ||
42 | @@ -57,7 +57,7 @@ struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls, int namelen) | |
43 | ||
44 | DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); | |
45 | ||
46 | - r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); | |
47 | + r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation); | |
48 | return r; | |
49 | } | |
50 | ||
51 | @@ -72,7 +72,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls) | |
52 | { | |
53 | struct dlm_lkb *lkb; | |
54 | ||
55 | - lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL); | |
56 | + lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation); | |
57 | return lkb; | |
58 | } | |
59 | ||
60 | diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c | |
61 | index 07ac709..f3396c6 100644 | |
62 | --- a/fs/dlm/midcomms.c | |
63 | +++ b/fs/dlm/midcomms.c | |
64 | @@ -112,7 +112,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base, | |
65 | ordinary messages). */ | |
66 | ||
67 | if (msglen > sizeof(__tmp) && p == &__tmp.p) { | |
68 | - p = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); | |
69 | + p = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS); | |
70 | if (p == NULL) | |
71 | return ret; | |
72 | } |