Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Steven Whitehouse and committed by
David Teigland
d6d7b702 58e20d8d

+5 -4
+1
fs/dlm/lowcomms.c
··· 295 295 con->sock->sk->sk_write_space = lowcomms_write_space; 296 296 con->sock->sk->sk_state_change = lowcomms_state_change; 297 297 con->sock->sk->sk_user_data = con; 298 + con->sock->sk->sk_allocation = GFP_NOFS; 298 299 return 0; 299 300 } 300 301
+3 -3
fs/dlm/memory.c
··· 39 39 { 40 40 char *p; 41 41 42 - p = kzalloc(ls->ls_lvblen, GFP_KERNEL); 42 + p = kzalloc(ls->ls_lvblen, ls->ls_allocation); 43 43 return p; 44 44 } 45 45 ··· 57 57 58 58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); 59 59 60 - r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); 60 + r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation); 61 61 return r; 62 62 } 63 63 ··· 72 72 { 73 73 struct dlm_lkb *lkb; 74 74 75 - lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL); 75 + lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation); 76 76 return lkb; 77 77 } 78 78
+1 -1
fs/dlm/midcomms.c
··· 112 112 ordinary messages). */ 113 113 114 114 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); 116 116 if (p == NULL) 117 117 return ret; 118 118 }