Skip to content

Commit d6d7b70

Browse files
swhitehoteigland
authored andcommitted
dlm: fix up memory allocation flags
Use ls_allocation for memory allocations, which a cluster fs sets to GFP_NOFS. Use GFP_NOFS for allocations when no lockspace struct is available. Taking dlm locks needs to avoid calling back into the cluster fs because write-out can require taking dlm locks. Cc: Christine Caulfield <ccaulfie@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 58e20d8 commit d6d7b70

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎fs/dlm/lowcomms.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ static int add_sock(struct socket *sock, struct connection *con)
295295
con->sock->sk->sk_write_space = lowcomms_write_space;
296296
con->sock->sk->sk_state_change = lowcomms_state_change;
297297
con->sock->sk->sk_user_data = con;
298+
con->sock->sk->sk_allocation = GFP_NOFS;
298299
return 0;
299300
}
300301

‎fs/dlm/memory.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ char *dlm_allocate_lvb(struct dlm_ls *ls)
3939
{
4040
char *p;
4141

42-
p = kzalloc(ls->ls_lvblen, GFP_KERNEL);
42+
p = kzalloc(ls->ls_lvblen, ls->ls_allocation);
4343
return p;
4444
}
4545

@@ -57,7 +57,7 @@ struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls, int namelen)
5757

5858
DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,);
5959

60-
r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL);
60+
r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation);
6161
return r;
6262
}
6363

@@ -72,7 +72,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls)
7272
{
7373
struct dlm_lkb *lkb;
7474

75-
lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL);
75+
lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation);
7676
return lkb;
7777
}
7878

‎fs/dlm/midcomms.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base,
112112
ordinary messages). */
113113

114114
if (msglen > sizeof(__tmp) && p == &__tmp.p) {
115-
p = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL);
115+
p = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS);
116116
if (p == NULL)
117117
return ret;
118118
}

0 commit comments

Comments
 (0)